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 df93dd75ef Stabilize proxy protocol access log test (#13462)
df93dd75ef is described below

commit df93dd75ef0da1ff035478735989d3996e1aea5b
Author: Brian Neradt <[email protected]>
AuthorDate: Thu Jul 30 19:13:13 2026 -0500

    Stabilize proxy protocol access log test (#13462)
    
    Access log records for independent PROXY Protocol replay sessions can be
    finalized on different event threads. The test assumed replay order and
    failed intermittently when two otherwise correct records were reversed.
    
    This waits for all expected records and sorts them before comparing
    against the full gold output. It preserves content and count coverage
    without requiring transaction completion order.
---
 tests/gold_tests/proxy_protocol/gold/access-cp.gold    |  4 ++--
 tests/gold_tests/proxy_protocol/gold/access-nocp.gold  |  4 ++--
 tests/gold_tests/proxy_protocol/proxy_protocol.test.py | 15 +++++++++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/tests/gold_tests/proxy_protocol/gold/access-cp.gold 
b/tests/gold_tests/proxy_protocol/gold/access-cp.gold
index 28d355ac6a..c2f386d799 100644
--- a/tests/gold_tests/proxy_protocol/gold/access-cp.gold
+++ b/tests/gold_tests/proxy_protocol/gold/access-cp.gold
@@ -1,8 +1,8 @@
+127.0.0.1 0 127.0.0.1
+127.0.0.1 0 127.0.0.1
 127.0.0.1 127.0.0.1 127.0.0.1
 127.0.0.1 127.0.0.1 127.0.0.1
 127.0.0.1 127.0.0.1 127.0.0.1
 127.0.0.1 127.0.0.1 127.0.0.1
 198.51.100.1 198.51.100.1 127.0.0.1
-127.0.0.1 0 127.0.0.1
-127.0.0.1 0 127.0.0.1
 198.51.100.1 198.51.100.1 127.0.0.1
diff --git a/tests/gold_tests/proxy_protocol/gold/access-nocp.gold 
b/tests/gold_tests/proxy_protocol/gold/access-nocp.gold
index 5511d71605..ccd785d680 100644
--- a/tests/gold_tests/proxy_protocol/gold/access-nocp.gold
+++ b/tests/gold_tests/proxy_protocol/gold/access-nocp.gold
@@ -1,8 +1,8 @@
+127.0.0.1 0 127.0.0.1
+127.0.0.1 0 127.0.0.1
 127.0.0.1 127.0.0.1 127.0.0.1
 127.0.0.1 127.0.0.1 127.0.0.1
 127.0.0.1 127.0.0.1 127.0.0.1
 127.0.0.1 127.0.0.1 127.0.0.1
 127.0.0.1 198.51.100.1 127.0.0.1
-127.0.0.1 0 127.0.0.1
-127.0.0.1 0 127.0.0.1
 127.0.0.1 198.51.100.1 127.0.0.1
diff --git a/tests/gold_tests/proxy_protocol/proxy_protocol.test.py 
b/tests/gold_tests/proxy_protocol/proxy_protocol.test.py
index a362393096..db4eede8a1 100644
--- a/tests/gold_tests/proxy_protocol/proxy_protocol.test.py
+++ b/tests/gold_tests/proxy_protocol/proxy_protocol.test.py
@@ -94,15 +94,22 @@ logging:
         """
         check access log
         """
-        Test.Disk.File(os.path.join(self.ts.Variables.LOGDIR, 'access.log'), 
exists=True, content=f"gold/access-{self.name}.gold")
+        log_file = os.path.join(self.ts.Variables.LOGDIR, 'access.log')
 
+        # Transactions can finish on different event threads, so their access
+        # log records are not guaranteed to be written in replay order.
         Test.AddAwaitFileContainsTestRun(
             f'Await PROXY protocol access log lines. {self.name}',
-            os.path.join(self.ts.Variables.LOGDIR, 'access.log'),
-            r'^127\.0\.0\.1 0 127\.0\.0\.1$',
-            2,
+            log_file,
+            r'^(127\.0\.0\.1|198\.51\.100\.1) (0|127\.0\.0\.1|198\.51\.100\.1) 
127\.0\.0\.1$',
+            8,
         )
 
+        tr = Test.AddTestRun(f'Verify PROXY protocol access log lines. 
{self.name}')
+        tr.Processes.Default.Command = f'LC_ALL=C sort < "{log_file}"'
+        tr.Processes.Default.Streams.stdout = f"gold/access-{self.name}.gold"
+        tr.Processes.Default.ReturnCode = 0
+
     def run(self):
         self.runTraffic()
         self.checkAccessLog()

Reply via email to