-
Notifications
You must be signed in to change notification settings - Fork 6
Add basic h2 proto tests #155
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
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
__all__ = ['client', 'deproxy_client', 'deproxy_manager', 'deproxy_server', | ||
'nginx_server', 'templates', 'tester', 'wrk_client', 'port_checks'] | ||
'nginx_server', 'templates', 'tester', 'wrk_client', 'port_checks', | ||
'external_client'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from . import client | ||
|
||
|
||
__author__ = 'Tempesta Technologies, Inc.' | ||
__copyright__ = 'Copyright (C) 2020 Tempesta Technologies, Inc.' | ||
__license__ = 'GPL2' | ||
|
||
class ExternalTester(client.Client): | ||
|
||
def __init__(self, cmd_args, **kwargs): | ||
client.Client.__init__(self, **kwargs) | ||
self.options = [cmd_args] | ||
|
||
def form_command(self): | ||
cmd = ' '.join([self.bin] + self.options) | ||
return cmd | ||
|
||
def parse_out(self, stdout, stderr): | ||
return True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
__all__ = ['test_h2_specs'] | ||
|
||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
from helpers import tf_cfg | ||
from framework import tester | ||
|
||
__author__ = 'Tempesta Technologies, Inc.' | ||
__copyright__ = 'Copyright (C) 2020 Tempesta Technologies, Inc.' | ||
__license__ = 'GPL2' | ||
|
||
NGINX_CONFIG = """ | ||
pid ${pid}; | ||
worker_processes auto; | ||
|
||
events { | ||
worker_connections 1024; | ||
use epoll; | ||
} | ||
|
||
http { | ||
keepalive_timeout ${server_keepalive_timeout}; | ||
keepalive_requests ${server_keepalive_requests}; | ||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
|
||
open_file_cache max=1000; | ||
open_file_cache_valid 30s; | ||
open_file_cache_min_uses 2; | ||
open_file_cache_errors off; | ||
|
||
# [ debug | info | notice | warn | error | crit | alert | emerg ] | ||
# Fully disable log errors. | ||
error_log /dev/null emerg; | ||
|
||
# Disable access log altogether. | ||
access_log off; | ||
|
||
server { | ||
listen ${server_ip}:8000; | ||
|
||
location / { | ||
return 200; | ||
} | ||
location /nginx_status { | ||
stub_status on; | ||
} | ||
} | ||
} | ||
""" | ||
|
||
TEMPESTA_CONFIG = """ | ||
listen 443 proto=h2; | ||
|
||
srv_group default { | ||
server ${server_ip}:8000; | ||
} | ||
vhost default { | ||
tls_certificate ${general_workdir}/tempesta.crt; | ||
tls_certificate_key ${general_workdir}/tempesta.key; | ||
|
||
proxy_pass default; | ||
} | ||
|
||
cache 0; | ||
|
||
""" | ||
|
||
class H2Spec(tester.TempestaTest): | ||
'''Tests for h2 proto implementation. Run h2spec utility against Tempesta. | ||
Simply check return code and warnings in system log for test errors. | ||
''' | ||
|
||
clients = [ | ||
{ | ||
'id' : 'h2spec', | ||
'type' : 'external', | ||
'binary' : 'h2spec', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add |
||
'ssl' : True, | ||
'cmd_args' : '-tkh ${tempesta_ip}' | ||
}, | ||
] | ||
|
||
backends = [ | ||
{ | ||
'id' : 'nginx', | ||
'type' : 'nginx', | ||
'port' : '8000', | ||
'status_uri' : 'http://${server_ip}:8000/nginx_status', | ||
'config' : NGINX_CONFIG, | ||
} | ||
] | ||
|
||
tempesta = { | ||
'config' : TEMPESTA_CONFIG, | ||
} | ||
|
||
def test_h2_specs(self): | ||
h2spec = self.get_client('h2spec') | ||
# TODO: for now run only simple test to check http2 connectivity | ||
# After all h2-related issues will be fixed, remove the line | ||
h2spec.options.append('generic/4') | ||
|
||
self.start_all_servers() | ||
self.start_tempesta() | ||
self.start_all_clients() | ||
self.wait_while_busy(h2spec) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment what's the new class is for.