-
Notifications
You must be signed in to change notification settings - Fork 543
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
[tests] Scrub tests #3798
base: main
Are you sure you want to change the base?
[tests] Scrub tests #3798
Conversation
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
Adding stageone and stagetwo tests for [system] plugin. Also adding tag scrub for only testing scrub of sensitive data. And updating README with how to call scrub and stagetwo tests. Related: sosreport#3788 Related: sosreport#3789 Resolves: sosreport#3798 Signed-off-by: Jan Jansky <[email protected]>
Adding stageone and stagetwo tests for [system] plugin. Also adding tag scrub for only testing scrub of sensitive data. And updating README with how to call scrub and stagetwo tests. Related: sosreport#3788 Related: sosreport#3789 Resolves: sosreport#3798 Signed-off-by: Jan Jansky <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my limited knowledge of avocado tests, LGTM, just need to address Pavel's note about the password string
Adding stageone and stagetwo tests for [system] plugin. Also adding tag scrub for only testing scrub of sensitive data. And updating README with how to call scrub and stagetwo tests. Related: sosreport#3788 Related: sosreport#3789 Resolves: sosreport#3798 Signed-off-by: Jan Jansky <[email protected]>
Adding stageone and stagetwo tests for [system] plugin. Also adding tag scrub for only testing scrub of sensitive data. And updating README with how to call scrub and stagetwo tests. Related: sosreport#3788 Related: sosreport#3789 Resolves: sosreport#3798 Signed-off-by: Jan Jansky <[email protected]>
Adding stageone and stagetwo tests for [system] plugin. Also adding tag scrub for only testing scrub of sensitive data. And updating README with how to call scrub and stagetwo tests. Related: sosreport#3788 Related: sosreport#3789 Resolves: sosreport#3798 Signed-off-by: Jan Jansky <[email protected]>
self.assertFileGlobInArchive("/etc/systemd") | ||
self.assertFileGlobInArchive("/lib/systemd/system") | ||
self.assertFileGlobInArchive("/lib/systemd/user") | ||
self.assertFileGlobInArchive("/etc/vconsole.conf") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Glob
test is redundantly generic for a direct filename without a glob, but let it be..
Adding stageone and stagetwo tests for [system] plugin. Also adding tag scrub for only testing scrub of sensitive data. And updating README with how to call scrub and stagetwo tests. Related: sosreport#3788 Related: sosreport#3789 Resolves: sosreport#3798 Signed-off-by: Jan Jansky <[email protected]>
Adding stageone and stagetwo tests for [system] plugin. Also adding tag scrub for only testing scrub of sensitive data. And updating README with how to call scrub and stagetwo tests. Related: sosreport#3788 Related: sosreport#3789 Resolves: sosreport#3798 Signed-off-by: Jan Jansky <[email protected]>
Adding stageone and stagetwo tests for [system] plugin. Also adding tag scrub for only testing scrub of sensitive data. And updating README with how to call scrub and stagetwo tests. Related: sosreport#3788 Related: sosreport#3789 Resolves: sosreport#3798 Signed-off-by: Jan Jansky <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this one sat for so long without another review. Notes below.
files = [ | ||
('../../../tests/test_data/system_test_data', '/etc/sysconfig/proxy'), | ||
('../../../tests/test_data/system_test_data', '/etc/sysconfig/proxy1'), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mocked file functionality assumes the files are co-located with the test pyfile because the general design is that each test (which has associated mocked data with it) will be in its own subdir.
Rather than maintaining relative paths like this, place the test file in a subdir under tests/report_tests/plugin_tests and put the test case and the mocked data there.
files = [ | ||
('../../../tests/test_data/system_test_data', '/etc/systemd/system'), | ||
('../../../tests/test_data/system_test_data', '/lib/systemd/system'), | ||
('../../../tests/test_data/system_test_data', '/run/systemd/system'), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
def test_systemd_files_collected(self): | ||
for file in self.files: | ||
self.assertFileGlobInArchive(file[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why we're testing the collection of files we're mocking?
self.assertFileGlobInArchive("journalctl_--list-boots") | ||
self.assertFileGlobInArchive("ls_-alZR_.lib.systemd") | ||
self.assertFileGlobInArchive("resolvectl_statistics") | ||
self.assertFileGlobInArchive("resolvectl_status") | ||
self.assertFileGlobInArchive("systemctl_list-dependencies") | ||
self.assertFileGlobInArchive("systemctl_list-jobs") | ||
self.assertFileGlobInArchive("systemctl_list-machines") | ||
self.assertFileGlobInArchive("systemctl_list-timers_--all") | ||
self.assertFileGlobInArchive("systemctl_list-unit-files") | ||
self.assertFileGlobInArchive("systemctl_list-units") | ||
self.assertFileGlobInArchive("systemctl_list-units_--all") | ||
self.assertFileGlobInArchive("systemctl_list-units_--failed") | ||
self.assertFileGlobInArchive("systemctl_show_--all") | ||
self.assertFileGlobInArchive("systemctl_show-environment") | ||
self.assertFileGlobInArchive("systemctl_show_service_--all") | ||
self.assertFileGlobInArchive("systemctl_status_--all") | ||
self.assertFileGlobInArchive("systemd-analyze") | ||
self.assertFileGlobInArchive("systemd-analyze_blame") | ||
self.assertFileGlobInArchive("systemd-analyze_dump") | ||
self.assertFileGlobInArchive("systemd-analyze_plot.svg") | ||
self.assertFileGlobInArchive("systemd-delta") | ||
self.assertFileGlobInArchive("systemd-inhibit_--list") | ||
self.assertFileGlobInArchive("timedatectl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be using assertFileCollected
for specific file names.
self.assertFileGlobInArchive("/proc/sys") | ||
self.assertFileGlobInArchive("/etc/default") | ||
self.assertFileGlobInArchive("/etc/environment") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same. Use assertFileCollected
for specific paths, only use assertFileGlobInArchive
if there are actual globs being checked.
def test_system_files_collected(self): | ||
for file in self.files: | ||
self.assertFileGlobInArchive(file[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, not sure why we're testing for a collection that we're mocking to begin with.
Just thinking out loud here, we're not using the tag scrub anywhere. Is there a need for a new tag when we're already doing stageone and stagetwo tests and these are being encompassed by them? |
Adding stageone and stagetwo tests for [system] plugin.
Also adding tag scrub for only testing scrub of sensitive data.
And updating README with how to call scrub and stagetwo tests.
Related: #3788
Related: #3789
Resolves: #3798
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines