Bug 65985 - some error about executing the test_006_asserts.py
Summary: some error about executing the test_006_asserts.py
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_http2 (show other bugs)
Version: 2.4.51
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-30 01:56 UTC by chengyechun1
Modified: 2022-04-11 01:42 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chengyechun1 2022-03-30 01:56:10 UTC
Some errors appear when the test_006_asserts.py case is executed. After the ngHTTP is used to request the local HTML file, the service responds only to the HTML file. However, the JS and CSS links in the HTML file do not appear to be returned as the result. However, the test case expects that the result is returned.
test_006_assets.py ..FFF                                                                                                                                                                         [100%]

=============================================================================================== FAILURES ===============================================================================================
________________________________________________________________________________________ TestStore.test_006_03 _________________________________________________________________________________________

self = <test_006_assets.TestStore object at 0x7f1461e63b20>, env = <h2_env.H2TestEnv object at 0x7f1461e63a90>

    def test_006_03(self, env):
        # create the tiles files we originally had checked in
        exp_assets = [
            {"status": 200, "size": "10K", "path": "/004.html"},
            {"status": 200, "size": "742", "path": "/004/gophertiles.jpg"},
        ]
        for i in range(2, 181):
            with open(f"{env.server_docs_dir}/test1/004/gophertiles_{i:03d}.jpg", "w") as fd:
                fd.write("0123456789\n")
            exp_assets.append(
                {"status": 200, "size": "11", "path": f"/004/gophertiles_{i:03d}.jpg"},
            )

        url = env.mkurl("https", "test1", "/004.html")
        r = env.nghttp().assets(url, options=["-Haccept-encoding: none"])
        print(r.assets)
        assert 0 == r.exit_code
>       assert 181 == len(r.assets)
E       AssertionError: assert 181 == 1
E        +  where 1 = len([{'path': '/004.html', 'size': '10K', 'status': 200}])
E        +    where [{'path': '/004.html', 'size': '10K', 'status': 200}] = <h2_result.ExecResult object at 0x7f1462b2a0d0>.assets

test_006_assets.py:51: AssertionError
----------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------
execute: nghttp --header=host: test1.tests.httpd.apache.org:40002 -Haccept-encoding: none -ans https://127.0.0.1:40002//004.html
[{'path': '/004.html', 'status': 200, 'size': '10K'}]
________________________________________________________________________________________ TestStore.test_006_04 _________________________________________________________________________________________

self = <test_006_assets.TestStore object at 0x7f1462b344c0>, env = <h2_env.H2TestEnv object at 0x7f1461e63a90>

    def test_006_04(self, env):
        url = env.mkurl("https", "test1", "/006.html")
        r = env.nghttp().assets(url, options=["-Haccept-encoding: none"])
        assert 0 == r.exit_code
>       assert 3 == len(r.assets)
E       AssertionError: assert 3 == 1
E        +  where 1 = len([{'path': '/006.html', 'size': '543', 'status': 200}])
E        +    where [{'path': '/006.html', 'size': '543', 'status': 200}] = <h2_result.ExecResult object at 0x7f1462b34be0>.assets

test_006_assets.py:59: AssertionError
----------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------
execute: nghttp --header=host: test1.tests.httpd.apache.org:40002 -Haccept-encoding: none -ans https://127.0.0.1:40002//006.html
________________________________________________________________________________________ TestStore.test_006_05 _________________________________________________________________________________________

self = <test_006_assets.TestStore object at 0x7f1461ae3c70>, env = <h2_env.H2TestEnv object at 0x7f1461e63a90>

    def test_006_05(self, env):
        url = env.mkurl("https", "test1", "/003.html")
        r = env.nghttp().assets(url, options=["--window-bits=24", "-Haccept-encoding: none"])
        assert 0 == r.exit_code
>       assert 2 == len(r.assets)
E       AssertionError: assert 2 == 1
E        +  where 1 = len([{'path': '/003.html', 'size': '316', 'status': 200}])
E        +    where [{'path': '/003.html', 'size': '316', 'status': 200}] = <h2_result.ExecResult object at 0x7f1461ae3f70>.assets

test_006_assets.py:71: AssertionError
----------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------
execute: nghttp --header=host: test1.tests.httpd.apache.org:40002 --window-bits=24 -Haccept-encoding: none -ans https://127.0.0.1:40002//003.html
Comment 1 chengyechun1 2022-04-07 02:45:15 UTC
somebody help me? tks a lot
Comment 2 Stefan Eissing 2022-04-07 09:38:17 UTC
Which version of the test cases do you run? The ones included in the 2.4.51 release? Checkouts from the subversion branch 2.4.x?

What I would do is to insert a `time.sleep(300)` just before the failing assertion and then run the `nghttp` command line as listed below against the server to see what it returns.

If the manually executed command only produces a single resource and not all " assets", e.g. resources contained in the first ones html, the question becomes if the mismatch is an error in the server setup or if your "nghttp" has somehow trouble to do its job.
Comment 3 chengyechun1 2022-04-07 12:00:09 UTC
(In reply to Stefan Eissing from comment #2)
> Which version of the test cases do you run? The ones included in the 2.4.51
> release? Checkouts from the subversion branch 2.4.x?
> 
> What I would do is to insert a `time.sleep(300)` just before the failing
> assertion and then run the `nghttp` command line as listed below against the
> server to see what it returns.
> 
> If the manually executed command only produces a single resource and not all
> " assets", e.g. resources contained in the first ones html, the question
> becomes if the mismatch is an error in the server setup or if your "nghttp"
> has somehow trouble to do its job.

Thanks for your reply. The httpd version is 2.4.51 and the nghttp2 version is 1.46.0.1. I try to follow the method you said, and the result is the same. I think it has nothing to do with time.sleep (300). If the server replies only with the HTML file, the server does not parse the HTML file and sends the JS link in the HTML file again and returns the request, just like the browser.
I look forward to your reply again.
Comment 4 Stefan Eissing 2022-04-07 13:30:05 UTC
The call of "nghttp -a url" tells nghttp to *parse* the received html for links and also download all those links it finds. There is nothing the server needs to do special.

So, the question seems to be why the "-a" in nghttp does not seem to work for you. Does it work for other sites?
Comment 5 chengyechun1 2022-04-07 13:35:52 UTC
(In reply to Stefan Eissing from comment #4)
> The call of "nghttp -a url" tells nghttp to *parse* the received html for
> links and also download all those links it finds. There is nothing the
> server needs to do special.
> 
> So, the question seems to be why the "-a" in nghttp does not seem to work
> for you. Does it work for other sites?

This is the nghttp command executed by the test case: execute: nghttp --header=host: test1.tests.httpd.apache.org:40002 -Haccept-encoding: none -ans https://127.0.0.1:40002//006.html
You mean that the -a parameter in nghttp has no effect, which I did not expect, I will try; Thank you for your reply;
Comment 6 Rainer Jung 2022-04-07 19:59:33 UTC
The "-a" for nghttp2 does only work, if it was compiled with libxml2 support. Otherwise nghttp2 throws a warning or error and does not retrieve any assets.
Comment 7 Rainer Jung 2022-04-07 20:01:07 UTC
That would be the warning for such an nghttp which doesn't support -a:

[WARNING]: -a, --get-assets option is ignored because
the binary was not compiled with libxml2.
Comment 8 chengyechun1 2022-04-08 01:04:02 UTC
(In reply to Rainer Jung from comment #7)
> That would be the warning for such an nghttp which doesn't support -a:
> 
> [WARNING]: -a, --get-assets option is ignored because
> the binary was not compiled with libxml2.

yes,you are right;This error is reported when I run the nghttp -a command. Thank you.