aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2019-11-14 16:10:50 -0500
committerJake Hunsaker <jhunsake@redhat.com>2019-11-19 12:39:06 -0500
commit645b9c98dc8f509839e37055050be4f39d6161d2 (patch)
tree014eea6fd3169683c6ecae7f29a424de2ed419d0 /tests
parent7eb369e119cbf506e1951d5280e2a6996c6e1d12 (diff)
downloadsos-645b9c98dc8f509839e37055050be4f39d6161d2.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>
Diffstat (limited to 'tests')
-rw-r--r--tests/plugin_tests.py22
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):