ywkaras commented on code in PR #10874:
URL: https://github.com/apache/trafficserver/pull/10874#discussion_r1411151121
##########
tests/gold_tests/continuations/double.test.py:
##########
@@ -81,24 +81,33 @@
# 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"
Review Comment:
Seems like this could just be `echo waits for stats done`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]