Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tests/gold_tests/remap/remap_load_empty_failure.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,19 @@
ts.Disk.remap_config.AddLine(f"") # empty file
ts.Disk.records_config.update({'proxy.config.url_remap.min_rules_required': 1})
ts.ReturnCode = 33 # expect to Emergency fail due to empty "remap.config".
ts.Ready = When.FileContains(ts.Disk.diags_log.Name, "remap.config failed to load")
ts.Ready = 0

tr = Test.AddTestRun("test")

# 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, "remap.config failed to load")
watcher.StartBefore(ts)

tr.Processes.Default.Command = "echo howdy"
tr.TimeOut = 5
tr.Processes.Default.StartBefore(ts)
tr.Processes.Default.StartBefore(watcher)
17 changes: 13 additions & 4 deletions tests/gold_tests/shutdown/emergency.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,23 @@
# 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.Timeout = 5
tr.Processes.Default.StartBefore(watcher)

tr.Timeout = 5
ts.ReturnCode = 33
ts.Ready = When.FileContains(ts.Disk.traffic_out.Name, "testing emergency shutdown")
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"')
17 changes: 13 additions & 4 deletions tests/gold_tests/shutdown/fatal.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,23 @@
# 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.Timeout = 5
tr.Processes.Default.StartBefore(watcher)

tr.Timeout = 5
ts.ReturnCode = 70
ts.Ready = When.FileContains(ts.Disk.traffic_out.Name, "testing fatal shutdown")
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"')