diff options
author | Pavel Moravec <pmoravec@redhat.com> | 2024-03-11 15:50:11 +0100 |
---|---|---|
committer | Jake Hunsaker <jacob.r.hunsaker@gmail.com> | 2024-03-11 15:43:32 -0400 |
commit | cbecc160eccf6a530e10d6cd78542c9f2666da06 (patch) | |
tree | 5bbea8f7f0567d89265efb9939c1ab78775650dd | |
parent | ecda520d73114aab26ac025f89b575dc518c9b02 (diff) | |
download | sos-cbecc160eccf6a530e10d6cd78542c9f2666da06.tar.gz |
[tests] Add tests for cleaner's --skip-cleaning-files
Closes: #3469
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r-- | tests/cleaner_tests/basic_function_tests/report_with_mask.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/cleaner_tests/basic_function_tests/report_with_mask.py b/tests/cleaner_tests/basic_function_tests/report_with_mask.py index baee836a..06bb2122 100644 --- a/tests/cleaner_tests/basic_function_tests/report_with_mask.py +++ b/tests/cleaner_tests/basic_function_tests/report_with_mask.py @@ -72,13 +72,15 @@ class ReportWithMask(StageOneReportTest): self.assertEqual(imode_orig, imode_obfuscated) -class ReportWithCleanedKeywords(StageOneReportTest): - """Testing for obfuscated keywords provided by the user +class ReportWithUserCustomisations(StageOneReportTest): + """Testing for 1) obfuscated keywords provided by the user (--keywords option), + and 2) skipping to clean specific files (--skip-cleaning-files option) :avocado: tags=stageone """ - sos_cmd = '--clean -o filesys,kernel --keywords=fstab,Linux,tmp --no-update' + sos_cmd = '--clean -o filesys,kernel --keywords=fstab,Linux,tmp,BOOT_IMAGE,fs.dentry-state \ + --skip-cleaning-files proc/cmdline,sos_commands/*/sysctl* --no-update' # Will the 'tmp' be properly treated in path to working dir without raising an error? # To make this test effective, we assume the test runs on a system / with Policy @@ -96,6 +98,12 @@ class ReportWithCleanedKeywords(StageOneReportTest): def test_keyword_obfuscated_in_file(self): self.assertFileNotHasContent('sos_commands/kernel/uname_-a', 'Linux') + def test_skip_cleaning_single_file(self): + self.assertFileHasContent('proc/cmdline', 'BOOT_IMAGE') + + def test_skip_cleaning_glob_file(self): + self.assertFileHasContent('sos_commands/kernel/sysctl_-a', 'fs.dentry-state') + class DefaultRemoveBinaryFilesTest(StageTwoReportTest): """Testing that binary files are removed by default |