From 3fea9a564c4112d04f6324df0d8b212e78feb5b3 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Wed, 3 Nov 2021 11:02:54 -0400 Subject: [Plugin] Ensure specific plugin timeouts are only set for that plugin It was discovered that setting a specific plugin timeout via the `-k $plugin.timeout` option could influence the timeout setting for other plugins that are not also having their timeout explicitly set. Fix this by moving the default plugin opts into `Plugin.__init__()` so that each plugin is ensured a private copy of these default plugin options. Additionally, add more timeout data to plugin manifest entries to allow for better tracking of this setting. Adds a test case for this scenario. Closes: #2744 Signed-off-by: Jake Hunsaker --- tests/vendor_tests/redhat/rhbz2018033.py | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/vendor_tests/redhat/rhbz2018033.py (limited to 'tests/vendor_tests') diff --git a/tests/vendor_tests/redhat/rhbz2018033.py b/tests/vendor_tests/redhat/rhbz2018033.py new file mode 100644 index 00000000..25b9090c --- /dev/null +++ b/tests/vendor_tests/redhat/rhbz2018033.py @@ -0,0 +1,35 @@ +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. + +from sos_tests import StageTwoReportTest + + +class rhbz2018033(StageTwoReportTest): + """Test that control of plugin timeouts is independent of other plugin + timeouts. See #2744. + + https://bugzilla.redhat.com/show_bug.cgi?id=2018033 + + :avocado: tags=stagetwo + """ + + install_plugins = ['timeout_test'] + sos_cmd = '-vvv -o timeout_test,networking -k timeout_test.timeout=1 --plugin-timeout=123' + + def test_timeouts_separate(self): + self.assertSosUILogContains('Plugin timeout_test timed out') + self.assertSosUILogNotContains('Plugin networking timed out') + + def test_timeout_manifest_recorded(self): + testm = self.get_plugin_manifest('timeout_test') + self.assertTrue(testm['timeout_hit']) + self.assertTrue(testm['timeout'] == 1) + + netm = self.get_plugin_manifest('networking') + self.assertFalse(netm['timeout_hit']) + self.assertTrue(netm['timeout'] == 123) -- cgit