aboutsummaryrefslogtreecommitdiffstats
path: root/tests/cleaner_tests
Commit message (Collapse)AuthorAgeFilesLines
* [tests] Call cleaner with --no-update when using keywordsPavel Moravec2023-03-131-1/+1
| | | | | | | | | | When running avocado tests in a sequence on the same host, further tests are affected by cleaner default_mapping built from obfuscating specific keywords also. Prevent adding these keywords to the mapping. Resolves: #3165 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [tests] add a test covering #3160Pavel Moravec2023-03-081-0/+19
| | | | | | | | | Run the cleaner tests with obfuscating (also) "tmp" to cover files handling under sys_tmp. Related to: #3160 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [tests] Add test for #3071Pavel Moravec2023-02-161-1/+8
| | | | | | | | Add test for #3071 : Prevent obfuscating tmpDir Resolves: #3136 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [test] Add stage 2 test for ipv6 obfuscationMiroslav Hradilek2023-01-274-0/+68
| | | | | | Relates: #3060 Signed-off-by: Miroslav Hradilek <mhradile@redhat.com>
* [testing] Change location of mocked files for testsJake Hunsaker2023-01-1212-5/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, mocked files were kept under the `tests/test_data/` directory and generally mimic'd the file location they would be temporarily copied to during the execution of their relevant tests. This has a few maintainability drawbacks, and the handling of the `files` attribute for test cases as either strings or tuples is at best confusing. Improve on this by instead making the `files` references relative to where the test case file is written. This enables easier maintenance by keeping all test requirements closer together, rather than spread across the repo. As such, the `files` attribute now requires a list of tuples, taking the form `(relative_src, absolute_dest)`. Additionally, fake plugins for tests that need them to artificially test a specific criteria should also be included in the test's subdir now. Along with this change, move several StageTwo tests to their own subdirs that now contain both the test cases and the needed files for mocking. This should be the new design pattern going forward - if a test needs to mock files of any kind, put it in a new subdirectory (and if it doesn't need to mock files, continue to keep it in the relevant directory within the test suite). Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [cleaner] Replace encoding errors when opening filesJake Hunsaker2022-09-191-0/+34
| | | | | | | | | | | | | | | A scenario was found that if a file had encoding issues when `sos clean` went to open the file for obfuscation, we would stop processing the file but leave it in the archive, which had the potential to leave unobfuscated information in that file in the archive. Fix this, by using the `errors='replace'` parameter when opening archive files. This allows us to continue parsing the file normally, while replacing the problematic characters with `?`s. Closes: #3015 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [cirrus] Update Fedora images used in CI testsJake Hunsaker2022-08-312-3/+3
| | | | | | | | The Fedora 36 image is now available on GCP, so update our testing matrix to use it. Accordingly, this means we no longer need to build or maintain our own Fedora images going forward. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [clean,IP Parser] Skip obvious version files for the IP parserJake Hunsaker2022-07-191-0/+33
| | | | | | | | | | | For files that can be considered obvious version files - those that end specifically with either `version` or `version.txt` - skip processing via the IP parser, as this may lead to improper obfuscation of certain version strings. This is also applied to files ending in `release`. Closes: #2962 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [cleaner] Allow disabling specific parsers individuallyJake Hunsaker2022-06-151-0/+61
| | | | | | | | | | | Adds a new `--disable-parsers` option that allows users to selectively disable parsers for a given execution of `sos clean`. This may be useful in specific scenarios where obfuscation is not strictly needed for all the types of data we obfuscate, and where the user trusts whomever may be receiving the archive for review. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [clean, hostname] Fix unintentionally case sensitive shortname handlingJake Hunsaker2021-11-191-1/+20
| | | | | | | | 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>
* [clean] Provide archive abstractions to obfuscate more than sos archivesJake Hunsaker2021-09-133-0/+13
| | | | | | | | | | | | | | | | | | | | | This commit removes the restriction imposed on `sos clean` since its introduction in sos-4.0 to only work against known sos report archives or build directories. This is because there has been interest in using the obfuscation bits of sos in other data-collector projects. The `SoSObfuscationArchive()` class has been revamped to now be an abstraction for different types of archives, and the cleaner logic has been updated to leverage this new abstraction rather than assuming we're working on an sos archive. Abstractions are added for our own native use cases - that being `sos report` and `sos collect` for at-runtime obfuscation, as well as standalone archives previously generated. Further generic abstractions are available for plain directories and tarballs however these will not provide the same level of coverage as fully supported archive types, as is noted in the manpage for sos-clean. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] Add test for cleaning and existing archiveJake Hunsaker2021-08-042-24/+86
| | | | | | | | | | | | | | | | Adds a test that ensures we are properly extracting and cleaning an already existing archive (one is being included under tests/test_data/ now), much the same as we test for a proper `sos report --clean` run. As part of this, some aspects of the `full_report_run.py` test are moved into the base test classes, and the new `existing_archive.py` test will explicitly run `sos clean` instead of `sos report`. The included archive for obfuscation testing is taken from a stock Fedora 34 VM with a known configuration which is reflected in the items being tested for. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] Add new full-run clean test caseJake Hunsaker2021-06-301-0/+86
| | | | | | | | | | | Adds a new test case that captures a full, unrestricted, sos report and runs it through `sos clean` to enhance our confidence in `clean` performance. This is a StageTwo test as it will temporarily overwrite any existing default_mapping. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] Move report_with_mask tests to cleaner_tests directoryJake Hunsaker2021-06-221-0/+109
| | | | | | | | Moves the report_with_mask tests to be under the cleaner_tests/ directory. No changes are actually being made to the tests, this is an organization change. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] Add tests to ensure help outputJake Hunsaker2021-06-221-0/+35
In the past, there have been otherwise trivial typos and the like that have caused `--help` output to be unreliable. In the case of "help options" such as `--list-plugins` this also includes potentially unavailable detailed information about whatever is being listed. These tests are sanity checks to ensure that changes aren't regressing this behavior and that the informational output options, and `--help` directly, continue to provide the right output. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>