diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2021-11-17 13:11:33 -0500 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2021-11-19 13:09:10 -0500 |
commit | f9cb3cb48e9e2cb487f34ff6169affab3ec8127f (patch) | |
tree | 8874f0e776927b228c3ad4787e79ccc9e3d09f5d /tests | |
parent | b710852367a00f2a61aae203b02fe34416e3da84 (diff) | |
download | sos-f9cb3cb48e9e2cb487f34ff6169affab3ec8127f.tar.gz |
[clean, hostname] Fix unintentionally case sensitive shortname handling
It was discovered that our extra handling for shortnames was
unintentionally case sensitive. Fix this to ensure that shortnames are
obfuscated regardless of case in all collected text.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cleaner_tests/full_report_run.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/cleaner_tests/full_report_run.py b/tests/cleaner_tests/full_report_run.py index 2de54946..0b23acaf 100644 --- a/tests/cleaner_tests/full_report_run.py +++ b/tests/cleaner_tests/full_report_run.py @@ -26,6 +26,24 @@ class FullCleanTest(StageTwoReportTest): # replace with an empty placeholder, make sure that this test case is not # influenced by previous clean runs files = ['/etc/sos/cleaner/default_mapping'] + packages = { + 'rhel': ['python3-systemd'], + 'ubuntu': ['python3-systemd'] + } + + def pre_sos_setup(self): + # ensure that case-insensitive matching of FQDNs and shortnames work + from systemd import journal + from socket import gethostname + host = gethostname() + short = host.split('.')[0] + sosfd = journal.stream('sos-testing') + sosfd.write( + "This is a test line from sos clean testing. The hostname %s " + "should not appear, nor should %s in an obfuscated archive. The " + "shortnames of %s and %s should also not appear." + % (host.lower(), host.upper(), short.lower(), short.upper()) + ) def test_private_map_was_generated(self): self.assertOutputContains('A mapping of obfuscated elements is available at') @@ -40,8 +58,9 @@ class FullCleanTest(StageTwoReportTest): def test_hostname_not_in_any_file(self): host = self.sysinfo['pre']['networking']['hostname'] + short = host.split('.')[0] # much faster to just use grep here - content = self.grep_for_content(host) + content = self.grep_for_content(host) + self.grep_for_content(short) if not content: assert True else: |