MCPcopy Create free account
hub / github.com/apache/trafficserver / QuickServerTest

Class QuickServerTest

tests/gold_tests/slow_post/quick_server.test.py:26–127  ·  view source on GitHub ↗

Verify that ATS doesn't delay responses behind slow posts.

Source from the content-addressed store, hash-verified

24
25
26class QuickServerTest:
27 """Verify that ATS doesn't delay responses behind slow posts."""
28
29 _init_file = '__init__.py'
30 _http_utils = 'http_utils.py'
31 _slow_post_client = 'slow_post_client.py'
32 _quick_server = 'quick_server.py'
33
34 _dns_counter = 0
35 _server_counter = 0
36 _ts_counter = 0
37
38 def __init__(self, abort_request: bool, drain_request: bool, abort_response_headers: bool):
39 """Initialize the test.
40
41 :param drain_request: Whether the server should drain the request body.
42 :param abort_request: Whether the client should abort the request body.
43 before disconnecting.
44 """
45 self._should_drain_request = drain_request
46 self._should_abort_request = abort_request
47 self._should_abort_response_headers = abort_response_headers
48
49 def _configure_dns(self, tr: 'TestRun') -> None:
50 """Configure the DNS.
51
52 :param tr: The test run to associate with the DNS process with.
53 """
54 self._dns = tr.MakeDNServer(f'dns-{QuickServerTest._dns_counter}', default='127.0.0.1')
55 QuickServerTest._dns_counter += 1
56
57 def _configure_server(self, tr: 'TestRun'):
58 """Configure the origin server.
59
60 This server replies with a response immediately after receiving the
61 request headers.
62
63 :param tr: The test run to associate with the server process with.
64 """
65 server = tr.Processes.Process(f'server-{QuickServerTest._server_counter}')
66 QuickServerTest._server_counter += 1
67 port = get_port(server, "http_port")
68 server.Command = \
69 f'{sys.executable} {self._quick_server} 127.0.0.1 {port} '
70 if self._should_drain_request:
71 server.Command += '--drain-request '
72 if self._should_abort_response_headers:
73 server.Command += '--abort-response-headers '
74 server.Ready = When.PortOpenv4(port)
75 self._server = server
76
77 def _configure_traffic_server(self, tr: 'TestRun'):
78 """Configure ATS.
79
80 :param tr: The test run to associate with the ATS process with.
81 """
82 self._ts = tr.MakeATSProcess(f'ts-{QuickServerTest._ts_counter}')
83 QuickServerTest._ts_counter += 1

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected