This is an automated email from the ASF dual-hosted git repository. shinrich 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 cd2e49031c Fix double to watch for done like the other continuation tests (#10874) cd2e49031c is described below commit cd2e49031c7918a066fb31fb091dfafaf6fb818e Author: Susan Hinrichs <shinri...@aviatrix.com> AuthorDate: Thu Nov 30 13:10:31 2023 -0600 Fix double to watch for done like the other continuation tests (#10874) --- tests/gold_tests/continuations/double.test.py | 37 +++++++++++++++++---------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/tests/gold_tests/continuations/double.test.py b/tests/gold_tests/continuations/double.test.py index 52b11ca694..110c971984 100644 --- a/tests/gold_tests/continuations/double.test.py +++ b/tests/gold_tests/continuations/double.test.py @@ -81,24 +81,33 @@ tr.StillRunningAfter = ts # Signal that all the curl processes have completed and poll for done metric tr = Test.AddTestRun("Curl Done") -tr.Processes.Default.Command = ( - "traffic_ctl plugin msg done done ; " - "N=60 ; " - "while (( N > 0 )) ; " - "do " - "sleep 1 ; " - 'if [[ "$$( traffic_ctl metric get continuations_verify.test.done )" = ' - '"continuations_verify.test.done 1" ]] ; then exit 0 ; ' - "fi ; " - "let N=N-1 ; " - "done ; " - "echo TIMEOUT ; " - "exit 1" -) +tr.Processes.Default.Command = "traffic_ctl plugin msg done done" tr.Processes.Default.ReturnCode = 0 tr.Processes.Default.Env = ts.Env tr.StillRunningAfter = ts + +def make_done_stat_ready(tsenv): + def done_stat_ready(process, hasRunFor, **kw): + retval = subprocess.run( + "traffic_ctl metric get continuations_verify.test.done", + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + env=tsenv) + return retval.returncode == 0 and b'1' in retval.stdout + + return done_stat_ready + + +watcher = Test.Processes.Process("watcher", "sleep 20") + +tr = Test.AddTestRun("Wait for stats") +tr.Processes.Default.StartBefore(watcher, ready=make_done_stat_ready(ts.Env)) +tr.Processes.Default.Command = "traffic_ctl metric get continuations_verify.test.done" +tr.Processes.Default.ReturnCode = 0 +tr.Processes.Default.Env = ts.Env + # number of sessions/transactions opened and closed are equal tr = Test.AddTestRun("Check Ssn") tr.Processes.Default.Command = comparator_command.format('ssn')