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
Add package_* test scenarios #6752
Merged
matusmarhefka
merged 14 commits into
ComplianceAsCode:master
from
mildas:cis_package_tests
Apr 6, 2021
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bb9a055
Add package_openldap-clients_removed test scenarios
mildas 16883b6
Add package_xinetd_removed test scenarios
mildas 3105e50
Add package_chrony_installed test scenarios
mildas 6a5fa0c
Add package_squid_removed test scenarios
mildas a27b905
Add package_ypbind_removed test scenarios
mildas 49c094d
Add package_telnet_removed test scenarios
mildas c068296
Add package_xorg-x11-server-common_removed test scenarios
mildas e75791e
Add package_audit_installed test scenarios
mildas 744e631
Add package_firewalld_installed test scenarios
mildas ee525eb
Add package_libselinux_installed test scenario
mildas 9f5c218
Add package_mcstrans_removed test scenarios
mildas 0e6c9ec
Add package_setroubleshoot_removed test scenarios
mildas c185d0a
Add package_sudo_installed test scenarios
mildas 260fd62
Update package metadata in environment preparation phase in test scen…
mildas File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...de/services/ldap/openldap_client/package_openldap-clients_removed/tests/installed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y openldap-clients | ||
3 changes: 3 additions & 0 deletions
3
...uide/services/ldap/openldap_client/package_openldap-clients_removed/tests/removed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y openldap-clients |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/services/ntp/package_chrony_installed/tests/installed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y chrony |
3 changes: 3 additions & 0 deletions
3
linux_os/guide/services/ntp/package_chrony_installed/tests/removed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y chrony |
4 changes: 4 additions & 0 deletions
4
...s/guide/services/obsolete/inetd_and_xinetd/package_xinetd_removed/tests/installed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y xinetd |
3 changes: 3 additions & 0 deletions
3
..._os/guide/services/obsolete/inetd_and_xinetd/package_xinetd_removed/tests/removed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y xinetd |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/services/obsolete/nis/package_ypbind_removed/tests/installed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y ypbind |
3 changes: 3 additions & 0 deletions
3
linux_os/guide/services/obsolete/nis/package_ypbind_removed/tests/removed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y ypbind |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/services/obsolete/telnet/package_telnet_removed/tests/installed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y telnet |
3 changes: 3 additions & 0 deletions
3
linux_os/guide/services/obsolete/telnet/package_telnet_removed/tests/removed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y telnet |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/services/proxy/disabling_squid/package_squid_removed/tests/installed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y squid |
3 changes: 3 additions & 0 deletions
3
linux_os/guide/services/proxy/disabling_squid/package_squid_removed/tests/removed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y squid |
4 changes: 4 additions & 0 deletions
4
...windows/disabling_xwindows/package_xorg-x11-server-common_removed/tests/installed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y xorg-x11-server-common |
3 changes: 3 additions & 0 deletions
3
.../xwindows/disabling_xwindows/package_xorg-x11-server-common_removed/tests/removed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y xorg-x11-server-common |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/system/auditing/package_audit_installed/tests/installed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y audit |
3 changes: 3 additions & 0 deletions
3
linux_os/guide/system/auditing/package_audit_installed/tests/removed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y audit |
4 changes: 4 additions & 0 deletions
4
...etwork-firewalld/firewalld_activation/package_firewalld_installed/tests/installed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y firewalld |
3 changes: 3 additions & 0 deletions
3
.../network-firewalld/firewalld_activation/package_firewalld_installed/tests/removed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y firewalld |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/system/selinux/package_libselinux_installed/tests/installed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y libselinux |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/system/selinux/package_mcstrans_removed/tests/installed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y mcstrans |
3 changes: 3 additions & 0 deletions
3
linux_os/guide/system/selinux/package_mcstrans_removed/tests/removed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y mcstrans |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/system/selinux/package_setroubleshoot_removed/tests/installed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y setroubleshoot |
3 changes: 3 additions & 0 deletions
3
linux_os/guide/system/selinux/package_setroubleshoot_removed/tests/removed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum remove -y setroubleshoot |
4 changes: 4 additions & 0 deletions
4
linux_os/guide/system/software/sudo/package_sudo_installed/tests/installed.pass.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
# package = yum | ||
|
||
yum install -y sudo |
3 changes: 3 additions & 0 deletions
3
linux_os/guide/system/software/sudo/package_sudo_installed/tests/removed.fail.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
rpm -e --nodeps sudo |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What about using
# packages = openldap-clients
? I think it would perform better in case of combined mode as packages from this metadata should be installed at once before running the tests. Is that correct @matejak ?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.
Benefit I see in the implemented approach is that it's clear that the installation is the actual test scenario.
With the
# packages = ...
approach, the installation will be part of test environment preparation and scenario will be empty (or it might be required to call some command in the scenario liketrue
but nothing relevant to the test).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 prefer Milan's approach with this test
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.
Yes, my idea was to have it like that as fetching yum database in every test scenario will significantly increase the tests run time when testing all rules from a profile, for example in
combined
mode. Isn't it actually obvious from the filename of the test scenario that it is about installation/removal?To summarize, I am not strictly against this approach, but I would still prefer if we would use the
packages
metadata. I think that test suite run times are pretty high and I don't want to increase them even more if we don't have to.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 see both sides, and I think that there may be a solution - if you declare that you need the
yum
package, the test environment will have the package metadata up-to-date, so it will be only the installation that takes time for that scenario, and that's IMO OK. Moreover, the test scenario clearly needsyum
, so that's not a hack.Without that, I agree that every scenario would fetch the metadata again, which I see as a great waste of time and of electrical power.
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.
Interesting idea. I have added that in last commit, can you confirm that it's what you meant?
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.
@mildas Yes, thank you for updating test scenarios and thanks to @matejak for this clever idea :)