diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2020-01-28 17:54:59 +0100 |
---|---|---|
committer | Pavel Moravec <pmoravec@redhat.com> | 2020-01-28 17:56:21 +0100 |
commit | 9d1e5a0f7b757fa1c82aee7578ad4f7ab8080c5e (patch) | |
tree | e8dc594e3218d70c0001d4a92aab9a59a1b8b3f0 /tests/plugin_tests.py | |
parent | f41e8f22143391a4e38282e60fc8390713c3be10 (diff) | |
parent | 645b9c98dc8f509839e37055050be4f39d6161d2 (diff) | |
download | sos-9d1e5a0f7b757fa1c82aee7578ad4f7ab8080c5e.tar.gz |
[Plugin] Allow selectively disabling postprocessing
Adds two mechanisms by which users can choose to disable postprocessing
of collected information.
First, is a global method exposed via the `--no-postproc` option. Using
this option will skip postprocessing for all plugins.
Second, is a per-plugin option exposed via a new 'postproc' plugin
option. This is set to _True_ by default (meaning yes, perform
postprocessing), which users can set to False or off to disable
postprocessing for that plugin only; e.g. `-k podman.postproc=off`
Closes: #286
Resolves: #1862
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Diffstat (limited to 'tests/plugin_tests.py')
-rw-r--r-- | tests/plugin_tests.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py index 6522fe14..9f03afa2 100644 --- a/tests/plugin_tests.py +++ b/tests/plugin_tests.py @@ -75,6 +75,18 @@ class NamedMockPlugin(Plugin): pass +class PostprocMockPlugin(Plugin): + + did_postproc = False + + def setup(self): + pass + + def postproc(self): + if self.get_option('postproc'): + self.did_postproc = True + + class ForbiddenMockPlugin(Plugin): """This plugin has a description.""" @@ -97,6 +109,7 @@ class MockOptions(object): since = None log_size = 25 allow_system_changes = False + no_postproc = False class PluginToolTests(unittest.TestCase): @@ -239,6 +252,15 @@ class PluginTests(unittest.TestCase): p.collect() self.assertEquals(p.archive.m, {}) + def test_postproc_default_on(self): + p = PostprocMockPlugin({ + 'cmdlineopts': MockOptions(), + 'sysroot': self.sysroot, + 'policy': LinuxPolicy() + }) + p.postproc() + self.assertTrue(p.did_postproc) + class AddCopySpecTests(unittest.TestCase): |