diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2021-09-15 14:37:20 -0400 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2021-09-17 15:36:47 -0400 |
commit | 05be120ef94fecac2aacb44f44bb0d2f29998cf6 (patch) | |
tree | ecc2e557032db9ff5dc9b832a092e004feb2284f /tests/unittests/plugin_tests.py | |
parent | 5b76c1b3157e9f34b73d25cd84efb3809485f410 (diff) | |
download | sos-05be120ef94fecac2aacb44f44bb0d2f29998cf6.tar.gz |
[Plugin] Improve add_string_as_file collection and manifest recording
This commit allows plugins that call `add_string_as_file` to specify if
the string should be written to `sos_strings/$name/` (current behavior)
or if it should be written to `sos_commands/$name/` which may be
desireable for organizational purposes for plugin collections.
`add_string_as_file()` has also been updated to write to a plugin's
manifest section for any files written this way. Accordingly, the method
will now accept a `tags` parameter to add specified tags to the manifest
entry.
Certain plugins directly calling this method have been updated, but the
existing logic to write truncated data to `sos_strings/` remains
untouched, and will not generate manifest entries (as those should
already be handled by the method that trigged the truncated collection).
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/unittests/plugin_tests.py')
-rw-r--r-- | tests/unittests/plugin_tests.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/unittests/plugin_tests.py b/tests/unittests/plugin_tests.py index fcd24143..0105e3b8 100644 --- a/tests/unittests/plugin_tests.py +++ b/tests/unittests/plugin_tests.py @@ -339,10 +339,9 @@ class AddCopySpecTests(unittest.TestCase): self.mp.sysroot = '/' fn = create_file(2) # create 2MB file, consider a context manager self.mp.add_copy_spec(fn, 1) - content, fname = self.mp.copy_strings[0] + content, fname, _tags = self.mp.copy_strings[0] self.assertTrue("tailed" in fname) self.assertTrue("tmp" in fname) - self.assertTrue("/" not in fname) self.assertEquals(1024 * 1024, len(content)) os.unlink(fn) @@ -371,7 +370,7 @@ class AddCopySpecTests(unittest.TestCase): create_file(2, dir=tmpdir) self.mp.add_copy_spec(tmpdir + "/*", 1) self.assertEquals(len(self.mp.copy_strings), 1) - content, fname = self.mp.copy_strings[0] + content, fname, _tags = self.mp.copy_strings[0] self.assertTrue("tailed" in fname) self.assertEquals(1024 * 1024, len(content)) shutil.rmtree(tmpdir) |