Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test on correctness of serving short/long headers #169

Merged
merged 4 commits into from
Oct 9, 2020
Merged

Conversation

avbelov23
Copy link
Contributor

@avbelov23 avbelov23 commented Sep 23, 2020

'type' : 'external',
'binary' : 'curl',
'cmd_args' : (
'-k '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-f key might be handy here, Normally curl return 0 if a response is received, with the key it returns non-null code on 4xx and 5xx responses, and the test will be marked as failed.

h2/test_h2_headers.py Show resolved Hide resolved
encoding in HTTP/2. A request or response containing uppercase
header field names MUST be treated as malformed.
Ask curl to make an h2 request, if header field names are not converted to
lowercase then curl return code is not 0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meaningless copy-paste. Just say that it's the same case as <...> but checks cached, not forwarded responses.

h2/test_h2_headers.py Show resolved Hide resolved
'config' : NGINX_CONFIG % """
add_header X-Extra-Data1 "q";
add_header X-Extra-Data2 "q";
add_header X-Extra-Data1 "q";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not some random set of headers, but it's related to existing issue. Need to explicitly add description on the case and why do we have it here. Also tempesta-tech/tempesta#1408 tells about multiple cases, long and short ones, with cache and without. All of them must be covered.

@avbelov23 avbelov23 changed the title Test for converting header field names to lowercase for h2 Test on correctness of serving short/long headers Oct 5, 2020
Copy link
Contributor

@vankoven vankoven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

h2/test_h2_headers.py Show resolved Hide resolved

class AddBackendShortHeaders(CurlTestBase):
''' The test checks the correctness of forwarding short headers with
duplication
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like incomplete sentence. Need to highlight that headers in the test response must be specifically ordered.

CurlTestBase.test(self)
nginx = self.get_server('nginx')
nginx.get_stats()
self.assertEqual(1, nginx.requests)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I wanted to say that it's better to check counters on Tempesta side. But I see your intention, backend counters won't lie about serving from cache, while system under test possibly can. So Ok, lets leave it as is.

h2/test_h2_headers.py Outdated Show resolved Hide resolved
h2/test_h2_headers.py Show resolved Hide resolved
@avbelov23 avbelov23 force-pushed the avb-1380 branch 2 times, most recently from 59bc27e to 79f436c Compare October 8, 2020 15:28
Copy link
Contributor

@vankoven vankoven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few changes are required. I believe it's the last review iteration and we don't need another one. Just merge it once everything is resolved.

},
{
"cmd" : tf_cfg.cfg.get("Client", "h2load"),
"install" : "h2load"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is package name, nghttp2-client for Debian if I'm not mistaken.

}

def test(self):
CurlTestBase.test(self)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there is no need to override test() function from CurlTestBase class here.


nginx = self.get_server('nginx')
nginx.get_stats()
self.assertEqual(1 if served_from_cache else 2, nginx.requests)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a msg attribute here to provide a good explanation what happened wrong here. It's very handy when a test fails. Saves a lot of time on debugging.

'type' : 'external',
'binary' : 'h2load',
'ssl' : True,
'cmd_args' : ' https://${tempesta_ip} -D100'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duration is configured in tests configuration file. Better to follow that value and avoid hardcoded ones. Unless hardcoded test duration if really required, e.g. to stay in sync with some OS/application timers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dependence on time. The duration from the config may be small

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants