Run the test.
(self)
| 91 | }) |
| 92 | |
| 93 | def run(self): |
| 94 | """Run the test.""" |
| 95 | tr = Test.AddTestRun( |
| 96 | f'Aborting request: {self._should_abort_request}, ' |
| 97 | f'Draining request: {self._should_drain_request}, ' |
| 98 | f'Aborting response headers: {self._should_abort_response_headers}') |
| 99 | |
| 100 | self._configure_dns(tr) |
| 101 | self._configure_server(tr) |
| 102 | self._configure_traffic_server(tr) |
| 103 | |
| 104 | tools_dir = self._ts.Variables.AtsTestToolsDir |
| 105 | http_utils = os.path.join(tools_dir, 'http_utils.py') |
| 106 | tr.Setup.CopyAs(self._init_file, Test.RunDirectory) |
| 107 | tr.Setup.CopyAs(http_utils, Test.RunDirectory) |
| 108 | tr.Setup.CopyAs(self._slow_post_client, Test.RunDirectory) |
| 109 | tr.Setup.CopyAs(self._quick_server, Test.RunDirectory) |
| 110 | |
| 111 | client_command = (f'{sys.executable} {self._slow_post_client} ' |
| 112 | '127.0.0.1 ' |
| 113 | f'{self._ts.Variables.port} ') |
| 114 | if not self._should_abort_request: |
| 115 | client_command += '--finish-request ' |
| 116 | p = tr.Processes.Default |
| 117 | p.Command = client_command |
| 118 | if self._should_abort_request or self._should_abort_response_headers: |
| 119 | p.Streams.All += Testers.ExcludesExpression('HTTP/1.1 200 OK', 'Verify response was received') |
| 120 | else: |
| 121 | p.Streams.All += Testers.ContainsExpression('HTTP/1.1 200 OK', 'Verify response was received') |
| 122 | |
| 123 | p.ReturnCode = 0 |
| 124 | self._ts.StartBefore(self._dns) |
| 125 | self._ts.StartBefore(self._server) |
| 126 | p.StartBefore(self._ts) |
| 127 | tr.Timeout = 10 |
| 128 | |
| 129 | |
| 130 | for abort_request in [True, False]: |
no test coverage detected