aboutsummaryrefslogtreecommitdiffstats
path: root/tests/report_tests
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2022-08-19 13:23:59 -0400
committerJake Hunsaker <jhunsake@redhat.com>2022-09-28 09:48:46 -0400
commit339ab935cdb413fa811efacf6363c0cbc1998c55 (patch)
treefc9df28e8dfc5d8e2d64051c40523b2ba2672abc /tests/report_tests
parent15130f6aa2cec5b669636d5ba9ac6f1e417da3b2 (diff)
downloadsos-339ab935cdb413fa811efacf6363c0cbc1998c55.tar.gz
[Plugin] Allow for manual collections during collect phase
Historically, sos has limited collections to existing files and command output. While there have been many reasons for this, there have also been several exceptions made to current plugins as well as ongoing requests for data that is not currently provided via existing commands. As sos evolves, it should in turn be more capable to provide diagnostic data beyond what is strictly available via command outputs. As such, add a new step to the collection phase that allows plugins to perform these manual data collections. Plugins may now define their own `collect()` method to do so, thus moving the existing exceptions out of `setup()` phase execution. To aide in writing these collections to the plugin directory, a new `collection_file()` generator has been added which will handle creating, managing, and closing the new file so that plugins only need to be concerned with the content being written to such files. Plugin contributors should note that these manual collections are executed at the end of the collection phase - meaning they are more likely to be skipped or interrupted due to plugin timeouts. Closes: #2992 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/report_tests')
-rw-r--r--tests/report_tests/plugin_tests/collet_manual_tests.py (renamed from tests/report_tests/plugin_tests/string_collection_tests.py)10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/report_tests/plugin_tests/string_collection_tests.py b/tests/report_tests/plugin_tests/collet_manual_tests.py
index 05091a2e..fdcda526 100644
--- a/tests/report_tests/plugin_tests/string_collection_tests.py
+++ b/tests/report_tests/plugin_tests/collet_manual_tests.py
@@ -10,8 +10,8 @@
from sos_tests import StageOneReportTest
-class CollectStringTest(StageOneReportTest):
- """Test to ensure that add_string_as_file() is working for plugins that
+class CollectManualTest(StageOneReportTest):
+ """Test to ensure that collect() is working for plugins that
directly call it as part of their collections
:avocado: tags=stageone
@@ -30,8 +30,8 @@ class CollectStringTest(StageOneReportTest):
def test_no_strings_dir(self):
self.assertFileNotCollected('sos_strings/')
- def test_manifest_strings_correct(self):
+ def test_manifest_collections_correct(self):
pkgman = self.get_plugin_manifest('unpackaged')
- self.assertTrue(pkgman['strings']['unpackaged'])
+ self.assertTrue(pkgman['collections']['unpackaged'])
pyman = self.get_plugin_manifest('python')
- self.assertTrue(pyman['strings']['digests_json'])
+ self.assertTrue(pyman['collections']['digests'])