From dc2bff9708d7dbb6447ed2c5f28eb9bfd52667a5 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Fri, 19 Aug 2022 14:26:59 -0400 Subject: [process,PackageManager] Create a mapping of processes to packages Adds a new manual collection to the `process` plugin, that tries to compile a mapping of running processes' binaries to an owning package via the package manager. As such, package managers now have a new `pkg_by_path()` method that serves this purpose. Closes: #1350 Signed-off-by: Jake Hunsaker --- .../plugin_tests/collect_manual_tests.py | 37 ++++++++++++++++++++++ .../plugin_tests/collet_manual_tests.py | 37 ---------------------- 2 files changed, 37 insertions(+), 37 deletions(-) create mode 100644 tests/report_tests/plugin_tests/collect_manual_tests.py delete mode 100644 tests/report_tests/plugin_tests/collet_manual_tests.py (limited to 'tests/report_tests') diff --git a/tests/report_tests/plugin_tests/collect_manual_tests.py b/tests/report_tests/plugin_tests/collect_manual_tests.py new file mode 100644 index 00000000..7000d5e0 --- /dev/null +++ b/tests/report_tests/plugin_tests/collect_manual_tests.py @@ -0,0 +1,37 @@ +# 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 StageOneReportTest + + +class CollectManualTest(StageOneReportTest): + """Test to ensure that collect() is working for plugins that + directly call it as part of their collections + + :avocado: tags=stageone + """ + + sos_cmd = '-o unpackaged,python -k python.hashes' + # unpackaged is only a RedHatPlugin + redhat_only = True + + def test_unpackaged_list_collected(self): + self.assertFileCollected('sos_commands/unpackaged/unpackaged') + + def test_python_hashes_collected(self): + self.assertFileCollected('sos_commands/python/digests.json') + + def test_no_strings_dir(self): + self.assertFileNotCollected('sos_strings/') + + def test_manifest_collections_correct(self): + pkgman = self.get_plugin_manifest('unpackaged') + self.assertTrue(pkgman['collections']['unpackaged']) + pyman = self.get_plugin_manifest('python') + self.assertTrue(pyman['collections']['digests.json']) diff --git a/tests/report_tests/plugin_tests/collet_manual_tests.py b/tests/report_tests/plugin_tests/collet_manual_tests.py deleted file mode 100644 index fdcda526..00000000 --- a/tests/report_tests/plugin_tests/collet_manual_tests.py +++ /dev/null @@ -1,37 +0,0 @@ -# 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 StageOneReportTest - - -class CollectManualTest(StageOneReportTest): - """Test to ensure that collect() is working for plugins that - directly call it as part of their collections - - :avocado: tags=stageone - """ - - sos_cmd = '-o unpackaged,python -k python.hashes' - # unpackaged is only a RedHatPlugin - redhat_only = True - - def test_unpackaged_list_collected(self): - self.assertFileCollected('sos_commands/unpackaged/unpackaged') - - def test_python_hashes_collected(self): - self.assertFileCollected('sos_commands/python/digests.json') - - def test_no_strings_dir(self): - self.assertFileNotCollected('sos_strings/') - - def test_manifest_collections_correct(self): - pkgman = self.get_plugin_manifest('unpackaged') - self.assertTrue(pkgman['collections']['unpackaged']) - pyman = self.get_plugin_manifest('python') - self.assertTrue(pyman['collections']['digests']) -- cgit