Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[avocado_tests] added default_mapping test #3286

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/cleaner_tests/basic_function_tests/report_with_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class DefaultRemoveBinaryFilesTest(StageTwoReportTest):

files = [('binary_test.tar.xz', '/var/log/binary_test.tar.xz')]
install_plugins = ['binary_test']
sos_cmd = '--clean -o binary_test,kernel,host'
sos_cmd = '--clean -o binary_test,kernel,host --no-update'

def test_binary_removed(self):
self.assertFileNotCollected('var/log/binary_test.tar.xz')
Expand All @@ -104,7 +104,7 @@ class KeepBinaryFilesTest(StageTwoReportTest):

files = [('binary_test.tar.xz', '/var/log/binary_test.tar.xz')]
install_plugins = ['binary_test']
sos_cmd = '--clean --keep-binary-files -o binary_test,kernel,host'
sos_cmd = '--clean --keep-binary-files -o binary_test,kernel,host --no-update'

def test_warning_message_shown(self):
self.assertOutputContains(
Expand Down
2 changes: 1 addition & 1 deletion tests/cleaner_tests/existing_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ExistingArchiveCleanTest(StageTwoReportTest):
:avocado: tags=stagetwo
"""

sos_cmd = '-v tests/test_data/%s.tar.xz' % ARCHIVE
sos_cmd = '-v tests/test_data/%s.tar.xz --no-update' % ARCHIVE
sos_component = 'clean'

def test_obfuscation_log_created(self):
Expand Down
8 changes: 8 additions & 0 deletions tests/cleaner_tests/full_report/full_report_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ def pre_sos_setup(self):
% (host.lower(), host.upper(), short.lower(), short.upper())
)

def test_default_mapping(self):
self.assertFileExists('/etc/sos/cleaner/default_mapping')
self.assertOutputContains('Wrote mapping to')
with open('/etc/sos/cleaner/default_mapping') as ref:
ref_data = ref.read()
map_count = ref_data.count("map")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this line redundant?

self.assertNotEqual(ref_data.count("_map"), 0)

def test_private_map_was_generated(self):
self.assertOutputContains('A mapping of obfuscated elements is available at')
map_file = re.findall('/.*sosreport-.*-private_map', self.cmd_output.stdout)[-1]
Expand Down
2 changes: 1 addition & 1 deletion tests/cleaner_tests/help_output_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CleanHelpTest(StageOneOutputTest):
:avocado: tags=stageone
"""

sos_cmd = 'clean --help'
sos_cmd = 'clean --help --no-update'

def test_all_help_sections_present(self):
self.assertOutputContains('Global Options:')
Expand Down
2 changes: 1 addition & 1 deletion tests/cleaner_tests/ipv6_test/ipv6_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IPv6Test(StageTwoReportTest):
"""

install_plugins = ['ipv6']
sos_cmd = '-v --clean -o ipv6'
sos_cmd = '-v --clean -o ipv6 --no-update'
sos_timeout = 600
# replace default mapping to avoid being influenced by previous runs
# place mock file with crafted address used by mocked plugin
Expand Down
2 changes: 1 addition & 1 deletion tests/cleaner_tests/report_disabled_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ReportDisabledParsersTest(StageOneReportTest):
:avocado: tags=stageone
"""

sos_cmd = '--clean -o host,kernel,networking --disable-parsers=ip'
sos_cmd = '--clean -o host,kernel,networking --disable-parsers=ip --no-update'

def test_local_ip_not_obfuscated(self):
self.assertFileHasContent('ip_addr', self.sysinfo['pre']['networking']['ip_addr'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SkipVersionIPParser(StageTwoReportTest):
('sos-test-version-noskip', NO_SKIP)
]
install_plugins = ['skip_versions']
sos_cmd = '--clean -o skip_versions'
sos_cmd = '--clean -o skip_versions --no-update'

def test_version_file_skipped(self):
self.assertFileCollected(DO_SKIP)
Expand Down
2 changes: 1 addition & 1 deletion tests/cleaner_tests/unicode_open/unicode_in_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UnicodeOpenTest(StageTwoReportTest):
:avocado: tags=stagetwo
"""

sos_cmd = '--clean -o unicode_test,networking,host'
sos_cmd = '--clean -o unicode_test,networking,host --no-update'
files = [('sos-test-unicode.txt', '/tmp/sos-test-unicode.txt')]
install_plugins = ['unicode_test']

Expand Down
2 changes: 1 addition & 1 deletion tests/report_tests/encryption_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class EncryptedCleanedReportTest(EncryptedReportTest):
"""

encrypt_pass = 'sostest'
sos_cmd = "-o host,networking --clean --encrypt-pass %s" % encrypt_pass
sos_cmd = "-o host,networking --clean --encrypt-pass %s --no-update" % encrypt_pass

def test_hostname_obfuscated(self):
self.assertFileHasContent('hostname', 'host0')
Expand Down
2 changes: 1 addition & 1 deletion tests/vendor_tests/redhat/rhbz1950350/rhbz1950350.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class rhbz1950350(StageTwoReportTest):
('clean_config_test.txt', '/var/log/clean_config_test.txt')
]

sos_cmd = '-v -o sos_extras --clean'
sos_cmd = '-v -o sos_extras --clean --no-update'

def test_clean_config_loaded(self):
self.assertSosLogContains("effective options now: (.*)? --clean --domains (.*)? --keywords (.*)?")
Expand Down