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 bac906de9c txn_box ramp autest reliability improvements (#11243)
bac906de9c is described below

commit bac906de9c3733bb553808c10cb167044ea0a4b5
Author: Brian Neradt <brian.ner...@gmail.com>
AuthorDate: Mon Apr 22 17:38:30 2024 -0500

    txn_box ramp autest reliability improvements (#11243)
    
    This updates the ramp test to actually ramp traffic to a dedicated
    "staging" server. It also reduces the number of transactions to 100.
    Both of these changes makes the test more reliable against spurious
    connection issues that caused the test to be flakey, especially in CI.
    
    Fixes: #11131
---
 .../pluginTest/txn_box/ramp/ramp.replay.yaml       |  4 ++-
 .../pluginTest/txn_box/ramp/ramp.test.py           | 31 +++++++++++++++-------
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/tests/gold_tests/pluginTest/txn_box/ramp/ramp.replay.yaml 
b/tests/gold_tests/pluginTest/txn_box/ramp/ramp.replay.yaml
index 99540faf85..5e22948c92 100644
--- a/tests/gold_tests/pluginTest/txn_box/ramp/ramp.replay.yaml
+++ b/tests/gold_tests/pluginTest/txn_box/ramp/ramp.replay.yaml
@@ -7,7 +7,9 @@ meta:
       select:
       - lt: 300
         do:
-          ua-req-host: "ex.two"
+        - ua-req-url-host: "ex.two"
+        - ua-req-url-port: {server_port}
+        - ua-req-scheme: "http"
 
   blocks:
   - base_request: &base_request
diff --git a/tests/gold_tests/pluginTest/txn_box/ramp/ramp.test.py 
b/tests/gold_tests/pluginTest/txn_box/ramp/ramp.test.py
index 3d42fe6190..7f44498b2e 100644
--- a/tests/gold_tests/pluginTest/txn_box/ramp/ramp.test.py
+++ b/tests/gold_tests/pluginTest/txn_box/ramp/ramp.test.py
@@ -18,7 +18,9 @@
 #
 #  Copyright 2020, Verizon Media
 #
+
 import os.path
+import tempfile
 
 Test.Summary = '''
 Test traffic ramping.
@@ -26,19 +28,30 @@ Test traffic ramping.
 
 Test.SkipUnless(Condition.PluginExists("txn_box.so"))
 
-RepeatCount = 1000
+RepeatCount = 100
+replay_file = 'ramp.replay.yaml'
+
+# Make a server representing a staging host to which we can ramp.
+server_ramp = Test.MakeVerifierServerProcess('pv-server-staging', replay_file)
+# Make it so that server-ramp is used in the txn_box config.
+orig_replay_file = os.path.join(Test.TestDirectory, replay_file)
+old_replay_content = open(orig_replay_file).read()
+new_replay_content = old_replay_content.replace('{server_port}', 
str(server_ramp.Variables.http_port))
+# There's no need to delete temp_replay because it will be cleaned up with the 
TestDirectory.
+temp_replay = tempfile.NamedTemporaryFile(dir=Test.RunDirectory, delete=False)
+# Reference this new replay file for all other TestRun processes.
+replay_file = temp_replay.name
+open(replay_file, 'w').write(new_replay_content)
 
 tr = Test.TxnBoxTestAndRun(
     "Ramping",
-    "ramp.replay.yaml",
-    remap=[('http://one.ex', 'http://three.ex', ('--key=meta.txn_box.remap', 
'ramp.replay.yaml'))],
-    verifier_client_args="--verbose diag --repeat {}".format(RepeatCount))
-
-with open(f"{tr.TestDirectory}/multi_ramp_common.py") as f:
-    code = compile(f.read(), "multi_ramp_common.py", 'exec')
-    exec(code)
+    replay_file,
+    remap=[('http://one.ex', 'http://three.ex', ('--key=meta.txn_box.remap', 
replay_file))],
+    verifier_client_args=f"--verbose diag --repeat {RepeatCount}",
+    verifier_server_args=f"--verbose diag")
 
 ts = tr.Variables.TS
-ts.Setup.Copy("ramp.replay.yaml", ts.Variables.CONFIGDIR)
+ts.StartBefore(server_ramp)
+ts.Setup.Copy(replay_file, ts.Variables.CONFIGDIR)
 ts.Setup.Copy("ramp.logging.yaml", os.path.join(ts.Variables.CONFIGDIR, 
"logging.yaml"))
 ts.Disk.records_config.update({'proxy.config.log.max_secs_per_buffer': 1})

Reply via email to