You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2023/04/26 20:12:52 UTC
[trafficserver] branch 9.2.x updated: 9.2.x Stabilize 92x emergency and fatal autests (#9641)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new a1eb6552e4 9.2.x Stabilize 92x emergency and fatal autests (#9641)
a1eb6552e4 is described below
commit a1eb6552e46ea35a64e8f1bd5076deddcbc36aca
Author: Brian Neradt <br...@gmail.com>
AuthorDate: Wed Apr 26 15:12:44 2023 -0500
9.2.x Stabilize 92x emergency and fatal autests (#9641)
* Fix autest flakiness due better Ready Conditions (#9372)
A number of tests were flakey because of race conditions between the AuTest framework finishing the Default TestRun process and ending the test, and therefore the traffic server process, before traffic server had time to exercise the expected functionality of the test. This improves the Ready conditions for these tests which should improve their reliability.
(cherry picked from commit c175aa45c29124ab01af8f1efa1222fca8ff41c8)
* Make autest ts shutdown tests more reliable (#9391)
This is a second iteration to further improve some of the autests that
exercise ATS shutting down during test execution. See #9372 for the
previous patch. The previous update improved reliability, but still had
a race condition between autest recognizing ATS process shutdown and ATS
writing the expected error log. If it detected the ts process ending
before the log was written, the autest would fail because the framework
thought the process ended before the Ready condition was satisfied. This
patch addresses this by using a separate process to wait upon the log
entry instead of making the ts Ready condition the content of the log
file.
(cherry picked from commit 086501cb58d7b872e955b49de952b554ba7b5685)
---
tests/gold_tests/shutdown/emergency.test.py | 17 ++++++++++++++---
tests/gold_tests/shutdown/fatal.test.py | 17 ++++++++++++++---
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/tests/gold_tests/shutdown/emergency.test.py b/tests/gold_tests/shutdown/emergency.test.py
index 3e4d9abdef..fcc18e85d9 100644
--- a/tests/gold_tests/shutdown/emergency.test.py
+++ b/tests/gold_tests/shutdown/emergency.test.py
@@ -40,12 +40,23 @@ ts.Disk.records_config.update({
# Load plugin
Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'emergency_shutdown.so'), ts)
-# www.example.com Host
tr = Test.AddTestRun()
+
+# We have to wait upon TS to emit the expected log message, but it cannot be
+# the ts Ready criteria because autest might detect the process going away
+# before it detects the log message. So we add a separate process that waits
+# upon the log message.
+watcher = Test.Processes.Process("watcher")
+watcher.Command = "sleep 1"
+watcher.Ready = When.FileContains(ts.Disk.diags_log.Name, "testing emergency shutdown")
+watcher.StartBefore(ts)
+
tr.Processes.Default.Command = 'printf "Emergency Shutdown Test"'
tr.Processes.Default.ReturnCode = 0
-tr.Processes.Default.StartBefore(ts)
+tr.Processes.Default.StartBefore(watcher)
+
+tr.Timeout = 5
ts.ReturnCode = 33
-ts.Ready = 0 # Need this to be 0 because we are testing shutdown, this is to make autest not think ats went away for a bad reason.
+ts.Ready = 0
ts.Disk.traffic_out.Content = Testers.ExcludesExpression('failed to shutdown', 'should NOT contain "failed to shutdown"')
ts.Disk.diags_log.Content = Testers.IncludesExpression('testing emergency shutdown', 'should contain "testing emergency shutdown"')
diff --git a/tests/gold_tests/shutdown/fatal.test.py b/tests/gold_tests/shutdown/fatal.test.py
index a36ea44e51..aa8e8c3303 100644
--- a/tests/gold_tests/shutdown/fatal.test.py
+++ b/tests/gold_tests/shutdown/fatal.test.py
@@ -40,12 +40,23 @@ ts.Disk.records_config.update({
# Load plugin
Test.PrepareTestPlugin(os.path.join(Test.Variables.AtsTestPluginsDir, 'fatal_shutdown.so'), ts)
-# www.example.com Host
tr = Test.AddTestRun()
+
+# We have to wait upon TS to emit the expected log message, but it cannot be
+# the ts Ready criteria because autest might detect the process going away
+# before it detects the log message. So we add a separate process that waits
+# upon the log message.
+watcher = Test.Processes.Process("watcher")
+watcher.Command = "sleep 1"
+watcher.Ready = When.FileContains(ts.Disk.diags_log.Name, "testing fatal shutdown")
+watcher.StartBefore(ts)
+
tr.Processes.Default.Command = 'printf "Fatal Shutdown Test"'
tr.Processes.Default.ReturnCode = 0
-tr.Processes.Default.StartBefore(ts)
+tr.Processes.Default.StartBefore(watcher)
+
+tr.Timeout = 5
ts.ReturnCode = 70
-ts.Ready = 0 # Need this to be 0 because we are testing shutdown, this is to make autest not think ats went away for a bad reason.
+ts.Ready = 0
ts.Disk.traffic_out.Content = Testers.ExcludesExpression('failed to shutdown', 'should NOT contain "failed to shutdown"')
ts.Disk.diags_log.Content = Testers.IncludesExpression('testing fatal shutdown', 'should contain "testing fatal shutdown"')