aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cleaner_tests/existing_archive.py
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2021-09-01 00:28:58 -0400
committerJake Hunsaker <jhunsake@redhat.com>2021-09-13 10:47:04 -0400
commitdecd39b7799a0579ea085b0da0728b6eabd49b38 (patch)
treefdb55757592367a0f9ac61d2eef9d3f66ab84d22 /tests/cleaner_tests/existing_archive.py
parent9f739f98114633ae2f2813f348eef3cd599aa516 (diff)
downloadsos-decd39b7799a0579ea085b0da0728b6eabd49b38.tar.gz
[clean] Provide archive abstractions to obfuscate more than sos archives
This commit removes the restriction imposed on `sos clean` since its introduction in sos-4.0 to only work against known sos report archives or build directories. This is because there has been interest in using the obfuscation bits of sos in other data-collector projects. The `SoSObfuscationArchive()` class has been revamped to now be an abstraction for different types of archives, and the cleaner logic has been updated to leverage this new abstraction rather than assuming we're working on an sos archive. Abstractions are added for our own native use cases - that being `sos report` and `sos collect` for at-runtime obfuscation, as well as standalone archives previously generated. Further generic abstractions are available for plain directories and tarballs however these will not provide the same level of coverage as fully supported archive types, as is noted in the manpage for sos-clean. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/cleaner_tests/existing_archive.py')
-rw-r--r--tests/cleaner_tests/existing_archive.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/cleaner_tests/existing_archive.py b/tests/cleaner_tests/existing_archive.py
index 0eaf6c8d..e13d1cae 100644
--- a/tests/cleaner_tests/existing_archive.py
+++ b/tests/cleaner_tests/existing_archive.py
@@ -28,6 +28,13 @@ class ExistingArchiveCleanTest(StageTwoReportTest):
def test_obfuscation_log_created(self):
self.assertFileExists(os.path.join(self.tmpdir, '%s-obfuscation.log' % ARCHIVE))
+ def test_archive_type_correct(self):
+ with open(os.path.join(self.tmpdir, '%s-obfuscation.log' % ARCHIVE), 'r') as log:
+ for line in log:
+ if "Loaded %s" % ARCHIVE in line:
+ assert 'as type sos report archive' in line, "Incorrect archive type detected: %s" % line
+ break
+
def test_from_cmdline_logged(self):
with open(os.path.join(self.tmpdir, '%s-obfuscation.log' % ARCHIVE), 'r') as log:
for line in log: