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

[tests] Scrub tests #3798

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[tests] Scrub tests #3798

wants to merge 1 commit into from

Conversation

jjansky1
Copy link
Contributor

@jjansky1 jjansky1 commented Oct 3, 2024

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

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3798
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

jjansky1 added a commit to jjansky1/sos that referenced this pull request Oct 3, 2024
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]>
jjansky1 added a commit to jjansky1/sos that referenced this pull request Oct 3, 2024
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]>
Copy link
Member

@jcastill jcastill left a 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

jjansky1 added a commit to jjansky1/sos that referenced this pull request Oct 7, 2024
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]>
jjansky1 added a commit to jjansky1/sos that referenced this pull request Oct 7, 2024
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]>
jjansky1 added a commit to jjansky1/sos that referenced this pull request Oct 7, 2024
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]>
Comment on lines +21 to +24
self.assertFileGlobInArchive("/etc/systemd")
self.assertFileGlobInArchive("/lib/systemd/system")
self.assertFileGlobInArchive("/lib/systemd/user")
self.assertFileGlobInArchive("/etc/vconsole.conf")
Copy link
Contributor

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..

jjansky1 added a commit to jjansky1/sos that referenced this pull request Oct 7, 2024
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]>
jjansky1 added a commit to jjansky1/sos that referenced this pull request Oct 7, 2024
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]>
Copy link
Member

@TurboTurtle TurboTurtle left a 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.

Comment on lines +80 to +83
files = [
('../../../tests/test_data/system_test_data', '/etc/sysconfig/proxy'),
('../../../tests/test_data/system_test_data', '/etc/sysconfig/proxy1'),
]
Copy link
Member

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.

Comment on lines +72 to +76
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'),
]
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Comment on lines +82 to +84
def test_systemd_files_collected(self):
for file in self.files:
self.assertFileGlobInArchive(file[1])
Copy link
Member

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?

Comment on lines +40 to +62
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")
Copy link
Member

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.

Comment on lines +21 to +23
self.assertFileGlobInArchive("/proc/sys")
self.assertFileGlobInArchive("/etc/default")
self.assertFileGlobInArchive("/etc/environment")
Copy link
Member

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.

Comment on lines +62 to +64
def test_system_files_collected(self):
for file in self.files:
self.assertFileGlobInArchive(file[1])
Copy link
Member

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.

@arif-ali
Copy link
Member

arif-ali commented Nov 4, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants