diff --git a/tests/mock_server/h2tls_mock_server.py b/tests/mock_server/h2tls_mock_server.py index 339bfc1ef..fddbd9d29 100644 --- a/tests/mock_server/h2tls_mock_server.py +++ b/tests/mock_server/h2tls_mock_server.py @@ -56,7 +56,6 @@ def __init__(self): self.stream_data = {} self.flow_control_futures = {} self.file_path = None - self.num_sentence_received = {} self.raw_headers = None self.download_test_length = 2500000000 self.out_bytes_per_second = 900 @@ -118,7 +117,7 @@ def handle_request_echo(self, stream_id: int, request_data: RequestData): - x-repeat-data: - Triggers send_repeat_data() with specified length - x-slow-response: true - Triggers send_slow_repeat_data() instead (requires x-repeat-data) - x-throughput-bps: - Override throughput for slow response (default 900) - + Without special headers, echoes request headers and body as JSON. """ headers_dict = dict(self.raw_headers) @@ -128,7 +127,7 @@ def handle_request_echo(self, stream_id: int, request_data: RequestData): response_headers = [(':status', expect_status)] self.conn.send_headers(stream_id, response_headers, end_stream=True) return - + # Check for x-repeat-data header repeat_data_header = headers_dict.get('x-repeat-data') if repeat_data_header: @@ -136,7 +135,7 @@ def handle_request_echo(self, stream_id: int, request_data: RequestData): length = int(repeat_data_header) response_headers = [(':status', '200')] self.conn.send_headers(stream_id, response_headers, end_stream=False) - + # Check for slow response if headers_dict.get('x-slow-response') == 'true': # Check for custom throughput @@ -149,7 +148,7 @@ def handle_request_echo(self, stream_id: int, request_data: RequestData): return except ValueError: pass # Fall through to echo behavior - + # Check for upload test (don't echo body, just return byte count) if headers_dict.get('x-upload-test') == 'true': body_bytes = request_data.data.getvalue() @@ -158,7 +157,7 @@ def handle_request_echo(self, stream_id: int, request_data: RequestData): self.conn.send_headers(stream_id, response_headers, end_stream=False) asyncio.ensure_future(self.send_data(data, stream_id)) return - + # Default echo behavior response_headers = [(':status', '200')] # Filter out headers that shouldn't be echoed back @@ -167,18 +166,18 @@ def handle_request_echo(self, stream_id: int, request_data: RequestData): # Response headers back and exclude pseudo headers and problematic headers if i[0][0] != ':' and i[0].lower() not in skip_headers: response_headers.append(i) - + body_bytes = request_data.data.getvalue() - + body = body_bytes.decode('utf-8') data = json.dumps( {"body": body, "bytes": len(body_bytes)}, indent=4, ).encode("utf8") - + # Add correct content-length for our response response_headers.append(('content-length', str(len(data)))) - + self.conn.send_headers(stream_id, response_headers, end_stream=False) asyncio.ensure_future(self.send_data(data, stream_id)) diff --git a/tests/test_connection_monitor.c b/tests/test_connection_monitor.c index 4937b15a2..c691126ba 100644 --- a/tests/test_connection_monitor.c +++ b/tests/test_connection_monitor.c @@ -231,7 +231,7 @@ static int s_do_http_monitoring_test( } static struct aws_http_connection_monitoring_options s_test_options = { - .allowable_throughput_failure_interval_seconds = 1, + .allowable_throughput_failure_interval_seconds = 2, .minimum_throughput_bytes_per_second = 1000, }; diff --git a/tests/test_stream_manager.c b/tests/test_stream_manager.c index 9de6996be..9142c7865 100644 --- a/tests/test_stream_manager.c +++ b/tests/test_stream_manager.c @@ -1770,7 +1770,7 @@ TEST_CASE(localhost_integ_h2_sm_connection_monitor_kill_slow_connection) { (void)ctx; struct aws_byte_cursor uri_cursor = aws_byte_cursor_from_c_str("https://localhost:3443/echo"); struct aws_http_connection_monitoring_options monitor_opt = { - .allowable_throughput_failure_interval_seconds = 1, + .allowable_throughput_failure_interval_seconds = 2, .minimum_throughput_bytes_per_second = 1000, }; struct sm_tester_options options = {