This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 168e23ac22 Fix quick_server autest to verify server response (#11512)
168e23ac22 is described below
commit 168e23ac22b9dd614aeb009d78a0e2e2f6a66b7b
Author: Brian Neradt <[email protected]>
AuthorDate: Fri Jul 5 18:15:30 2024 -0400
Fix quick_server autest to verify server response (#11512)
The quick_server.test.py autest incorrectly sent a literal '\r\n' four
bytes instead of the expected 2 bytes. The test still largely functioned
as needed, but didn't verify that the expected respone made it to the
client. This updates the test to verify that the 200 OK response makes
it to the client as expected. ATS behaves as expected, so there is no
production change needed.
---
tests/gold_tests/slow_post/quick_server.py | 8 ++++----
tests/gold_tests/slow_post/quick_server.test.py | 18 +++++++++++++-----
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/tests/gold_tests/slow_post/quick_server.py
b/tests/gold_tests/slow_post/quick_server.py
index 686a9bfc88..352f6f410d 100644
--- a/tests/gold_tests/slow_post/quick_server.py
+++ b/tests/gold_tests/slow_post/quick_server.py
@@ -67,9 +67,9 @@ def send_response(sock: socket.socket, abort_early: bool) ->
None:
if abort_early:
response = "HTTP/1."
else:
- response = (r"HTTP/1.1 200 OK\r\n"
- r"Content-Length: 0\r\n"
- r"\r\n")
+ response = ("HTTP/1.1 200 OK\r\n"
+ "Content-Length: 0\r\n"
+ "\r\n")
print(f'Sending:\n{response}')
sock.sendall(response.encode("utf-8"))
@@ -92,7 +92,7 @@ def main() -> int:
sock.close()
continue
- # Send a response now, before headers are read. This implements
+ # Send a response now, before the body is read. This implements
# the "quick" attribute of this quick_server.
send_response(sock, args.abort_response_headers)
diff --git a/tests/gold_tests/slow_post/quick_server.test.py
b/tests/gold_tests/slow_post/quick_server.test.py
index c17368d430..69b0755752 100644
--- a/tests/gold_tests/slow_post/quick_server.test.py
+++ b/tests/gold_tests/slow_post/quick_server.test.py
@@ -91,7 +91,10 @@ class QuickServerTest:
def run(self):
"""Run the test."""
- tr = Test.AddTestRun()
+ tr = Test.AddTestRun(
+ f'Aborting request: {self._should_abort_request}, '
+ f'Draining request: {self._should_drain_request}, '
+ f'Aborting response headers:
{self._should_abort_response_headers}')
self._configure_dns(tr)
self._configure_server(tr)
@@ -107,12 +110,17 @@ class QuickServerTest:
f'{self._ts.Variables.port} ')
if not self._should_abort_request:
client_command += '--finish-request '
- tr.Processes.Default.Command = client_command
-
- tr.Processes.Default.ReturnCode = 0
+ p = tr.Processes.Default
+ p.Command = client_command
+ if self._should_abort_request or self._should_abort_response_headers:
+ p.Streams.All += Testers.ExcludesExpression('HTTP/1.1 200 OK',
'Verify response was received')
+ else:
+ p.Streams.All += Testers.ContainsExpression('HTTP/1.1 200 OK',
'Verify response was received')
+
+ p.ReturnCode = 0
self._ts.StartBefore(self._dns)
self._ts.StartBefore(self._server)
- tr.Processes.Default.StartBefore(self._ts)
+ p.StartBefore(self._ts)
tr.Timeout = 10