-
Notifications
You must be signed in to change notification settings - Fork 44
Update mock server #927
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
Merged
Update mock server #927
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a5fca27
test localhost
1445072
updates to exclude tests
502d02c
add client connection test
328845d
disable if no localhost
600aa3c
hoping this works
1bf17c8
cleanup
18a5260
more cleanup
42d1cfb
address comments
05c505b
remove env variable
0d694de
should be a test step
1af3358
change to venv
92cfb66
absolute path
2f8fb34
maybe this works
d8f7239
change venv_path
716ff34
setup with test
2594d1c
import time
0ab3734
only 4 tests
91a4fb1
change log level
a88ddbf
update test
afb5d00
now run all
7805069
fix logging level
e7970c1
fix print
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,19 +1,56 @@ | ||
| import Builder | ||
| import subprocess | ||
| import socket | ||
| import sys | ||
| import time | ||
| import os | ||
|
|
||
|
|
||
| class LocalhostTest(Builder.Action): | ||
|
|
||
| def start(self, env): | ||
| python = sys.executable | ||
| venv_path = os.path.join(env.root_dir,'crt','aws-c-http','tests','mock_server', '.venv') | ||
|
|
||
| result = env.shell.exec(python, '-m', 'venv', venv_path) | ||
| if result.returncode != 0: | ||
| print("Could not start a virtual environment. The localhost integration tests will fail.", file=sys.stderr) | ||
| return | ||
|
|
||
| python = os.path.join(venv_path, "bin", "python") | ||
|
|
||
| result = env.shell.exec(python, '-m', 'pip', 'install', 'h11', 'h2', 'trio') | ||
| if result.returncode != 0: | ||
| print("Could not install python HTTP/2 server. The localhost integration tests will fail.", file=sys.stderr) | ||
| return | ||
|
|
||
| server_dir = os.path.join(env.root_dir,'crt','aws-c-http','tests','mock_server') | ||
|
|
||
| p1 = subprocess.Popen([python, "h2tls_mock_server.py"], cwd=server_dir) | ||
| p2 = subprocess.Popen([python, "h2non_tls_server.py"], cwd=server_dir) | ||
| p3 = subprocess.Popen([python, "h11mock_server.py"], cwd=server_dir) | ||
|
|
||
| # Wait for servers to be ready | ||
| ports = [3443, 3280, 8082, 8081] | ||
| for port in ports: | ||
| for attempt in range(30): | ||
| try: | ||
| with socket.create_connection(("localhost", port), timeout=1): | ||
| print(f"Server on port {port} is ready") | ||
| break | ||
| except (socket.error, ConnectionRefusedError, OSError): | ||
| if attempt == 29: | ||
| print(f"ERROR: Server on port {port} failed to start", file=sys.stderr) | ||
| time.sleep(1) | ||
|
|
||
| def run(self, env): | ||
| self.start(env) | ||
| env.shell.setenv('AWS_CRT_MEMORY_TRACING', '2') | ||
| actions = [] | ||
| if os.system("mvn -Dtest=Http2ClientLocalHostTest test -DredirectTestOutputToFile=true -DforkCount=0 \ | ||
|
|
||
| if os.system("mvn test -DredirectTestOutputToFile=true -DforkCount=0 \ | ||
| -Daws.crt.memory.tracing=2 \ | ||
| -Daws.crt.debugnative=true \ | ||
| -Daws.crt.log.level=Debug \ | ||
| -Daws.crt.log.level=Warn \ | ||
| -Daws.crt.localhost=true"): | ||
| # Failed | ||
| actions.append("exit 1") | ||
|
|
||
| return Builder.Script(actions, name='aws-crt-java-test') | ||
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
Submodule aws-c-http
updated
10 files
| +5 −4 | .builder/action/local-server-setup.py | |
| +1 −1 | README.md | |
| +1 −1 | bin/h2benchmark/README.md | |
| +126 −0 | tests/mock_server/README.md | |
| +259 −0 | tests/mock_server/h11mock_server.py | |
| +0 −0 | tests/mock_server/h2non_tls_server.py | |
| +87 −47 | tests/mock_server/h2tls_mock_server.py | |
| +0 −44 | tests/py_localhost/README.md | |
| +20 −5 | tests/test_localhost_integ.c | |
| +80 −10 | tests/test_stream_manager.c |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.