aboutsummaryrefslogtreecommitdiffstats
path: root/tests/report_tests
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2022-10-13 15:38:58 -0400
committerJake Hunsaker <jhunsake@redhat.com>2022-10-24 16:00:12 -0400
commita0112b5a4b68b5bb88a01f5b33ff99ce075b8a87 (patch)
treed53066d56a26c102d0c42da8e1bb170360cbc8a7 /tests/report_tests
parentcf81e71f134fb482bbe708abb6d5c356573c4c08 (diff)
downloadsos-a0112b5a4b68b5bb88a01f5b33ff99ce075b8a87.tar.gz
[report,Plugin] Add a tag summary to report manifest
After all plugins have run, sos will now generate a "tag summary" and add it to the report section of the manifest. This summary will be a json-formatted entry that details all collections within the report that have any tag associated with them at all. This should allow for easier parsing of the manifest by analyzers such as Red Hat Insights. As part of this change, commands will no longer be automatically tagged with the name of the binary used in the command collection. Additionally, manual collections performed by a plugin's `collect()` method will now be recorded in the manifest in the same manner as file and command output collections. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/report_tests')
-rw-r--r--tests/report_tests/basic_report_tests.py9
-rw-r--r--tests/report_tests/plugin_tests/collect_manual_tests.py4
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/report_tests/basic_report_tests.py b/tests/report_tests/basic_report_tests.py
index f98d0f6e..c5d7d3ae 100644
--- a/tests/report_tests/basic_report_tests.py
+++ b/tests/report_tests/basic_report_tests.py
@@ -33,6 +33,15 @@ class NormalSoSReport(StageOneReportTest):
def test_free_symlink_created(self):
self.assertFileCollected('free')
+ def test_tag_summary_created(self):
+ self.assertTrue(
+ 'tag_summary' in self.manifest['components']['report'],
+ "No tag summary generated in report"
+ )
+ self.assertTrue(
+ isinstance(self.manifest['components']['report']['tag_summary'], dict),
+ "Tag summary malformed"
+ )
class LogLevelTest(StageOneReportTest):
"""
diff --git a/tests/report_tests/plugin_tests/collect_manual_tests.py b/tests/report_tests/plugin_tests/collect_manual_tests.py
index 7000d5e0..f63a074e 100644
--- a/tests/report_tests/plugin_tests/collect_manual_tests.py
+++ b/tests/report_tests/plugin_tests/collect_manual_tests.py
@@ -32,6 +32,6 @@ class CollectManualTest(StageOneReportTest):
def test_manifest_collections_correct(self):
pkgman = self.get_plugin_manifest('unpackaged')
- self.assertTrue(pkgman['collections']['unpackaged'])
+ self.assertTrue(any(c['name'] == 'unpackaged' for c in pkgman['collections']))
pyman = self.get_plugin_manifest('python')
- self.assertTrue(pyman['collections']['digests.json'])
+ self.assertTrue(any(c['name'] == 'digests.json' for c in pyman['collections']))