aboutsummaryrefslogtreecommitdiffstats
path: root/tests/report_tests
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2022-02-17 16:41:10 -0500
committerJake Hunsaker <jhunsake@redhat.com>2022-03-02 11:53:08 -0500
commit1682e78d2a63aa771a8209b46382c109bd78e84d (patch)
tree0e3afc9cc6ea28f6c6ed4014b54d6e417aa50a4a /tests/report_tests
parent686351fc6768104504ee14b9cad4140b65a420a2 (diff)
downloadsos-1682e78d2a63aa771a8209b46382c109bd78e84d.tar.gz
[tests] Add a test for non-default plugin_timeout compliance
There was a gap in our testing that allows #2863 to escape our notice - that a `Plugin()`'s `plugin_timeout` attribute would be ignored if it wasn't set to `TIMEOUT_DEFAULT`. As that was resolved by #2864, add a test to ensure it remains working as expected. The expected resolution order for a plugin's whole timeout is as follows: 1. The value set by `-k plugin.timeout` 2. The value set by `--plugin-timeout` 3. The value hardcoded in the plugin via the `plugin_timeout` attr 4. `TIMEOUT_DEFAULT` Related: #2863 Related: #2864 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/report_tests')
-rw-r--r--tests/report_tests/timeout_tests.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/report_tests/timeout_tests.py b/tests/report_tests/timeout_tests.py
index 58678644..ffce9231 100644
--- a/tests/report_tests/timeout_tests.py
+++ b/tests/report_tests/timeout_tests.py
@@ -18,6 +18,10 @@ class PluginTimeoutTest(StageTwoReportTest):
install_plugins = ['timeout_test']
sos_cmd = '-o timeout_test -vvv --plugin-timeout=10'
+ def test_correct_plugin_timeout(self):
+ man = self.get_plugin_manifest('timeout_test')
+ self.assertEquals(man['timeout'], 10)
+
def test_plugin_timed_out(self):
self.assertSosLogNotContains('collected plugin \'timeout_test\' in')
self.assertSosUILogContains('Plugin timeout_test timed out')
@@ -33,7 +37,13 @@ class NativeCmdTimeoutTest(StageTwoReportTest):
"""
install_plugins = ['timeout_test']
- sos_cmd = '-o timeout_test -vvv'
+ sos_cmd = '-o timeout_test,host -vvv'
+
+ def test_correct_plugin_timeout(self):
+ man = self.get_plugin_manifest('timeout_test')
+ self.assertEquals(man['timeout'], 100)
+ hman = self.get_plugin_manifest('host')
+ self.assertEquals(hman['timeout'], 300)
def test_plugin_completed(self):
self.assertSosLogContains('collected plugin \'timeout_test\' in')
@@ -42,3 +52,18 @@ class NativeCmdTimeoutTest(StageTwoReportTest):
def test_command_timed_out(self):
self.assertSosLogContains(r"\[plugin:timeout_test\] command 'sleep 30' timed out after 10s")
self.assertFileCollected('sos_commands/timeout_test/sleep_30')
+
+class MultipleTimeoutValues(NativeCmdTimeoutTest):
+ """Test that our plugin timeout option priority is functioning correctly
+
+ :avocado: tags=stagetwo
+ """
+
+ install_plugins = ['timeout_test']
+ sos_cmd = '-o timeout_test,host --plugin-timeout=30 -k timeout_test.timeout=60'
+
+ def test_correct_plugin_timeout(self):
+ man = self.get_plugin_manifest('timeout_test')
+ self.assertEquals(man['timeout'], 60)
+ hman = self.get_plugin_manifest('host')
+ self.assertEquals(hman['timeout'], 30)