-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The virtual provision test includes the basic functionality and also when using with usmak 0027 Signed-off-by: Carlos Rodriguez-Fernandez <[email protected]>
- Loading branch information
1 parent
9b5ad48
commit 1019b67
Showing
23 changed files
with
170 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,2 @@ | ||
summary: Check that become works on podman provision | ||
description: Ensures that become works when used in containers. |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
1 |
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,7 @@ | ||
provision: | ||
how: virtual | ||
image: fedora | ||
user: fedora | ||
|
||
execute: | ||
how: tmt |
36 changes: 36 additions & 0 deletions
36
tests/provision/become/virtual/basic/data/prepare-finish.fmf
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,36 @@ | ||
discover: | ||
tests: | ||
- name: dummy-test | ||
test: echo "pass" | ||
|
||
/root: | ||
provision+: | ||
become: true | ||
|
||
/inline: | ||
prepare: | ||
script: test "$(whoami)" == "root" | ||
finish: | ||
script: test "$(whoami)" == "root" | ||
|
||
/scripts: | ||
prepare: | ||
script: scripts/is_root_test.sh | ||
finish: | ||
script: scripts/is_root_test.sh | ||
|
||
/user: | ||
provision+: | ||
become: false | ||
|
||
/inline: | ||
prepare: | ||
script: test "$(whoami)" == "fedora" | ||
finish: | ||
script: test "$(whoami)" == "fedora" | ||
|
||
/scripts: | ||
prepare: | ||
script: scripts/is_user_test.sh | ||
finish: | ||
script: scripts/is_user_test.sh |
3 changes: 3 additions & 0 deletions
3
tests/provision/become/virtual/basic/data/scripts/is_root_test.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 -e | ||
|
||
test "$(whoami)" == "root" |
3 changes: 3 additions & 0 deletions
3
tests/provision/become/virtual/basic/data/scripts/is_user_test.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 -e | ||
|
||
test "$(whoami)" == "fedora" |
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,15 @@ | ||
/root: | ||
provision+: | ||
become: true | ||
discover: | ||
tests: | ||
- name: user-is-root | ||
test: test "$(whoami)" == "root" | ||
|
||
/user: | ||
provision+: | ||
become: false | ||
discover: | ||
tests: | ||
- name: user-is-user | ||
test: test "$(whoami)" == "fedora" |
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,2 @@ | ||
summary: Check that become works on virtual provision | ||
description: Ensures that become works when used in virtual instances. |
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,40 @@ | ||
#!/bin/bash | ||
. /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
||
PROVISION_METHODS=${PROVISION_METHODS:-virtual} | ||
|
||
rlJournalStart | ||
if [[ "$PROVISION_METHODS" =~ virtual ]]; then | ||
rlPhaseStartSetup | ||
rlRun "pushd data" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Virtual, test with become=true" | ||
rlRun "tmt run -rvvv plan --name /test/root" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Virtual, test with become=false" | ||
rlRun "tmt run -rvvv plan --name /test/user" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Virtual, prepare/finish inline with become=true" | ||
rlRun "tmt run -rvvv plan --name /prepare-finish/root/inline" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Virtual, prepare/finish inline with become=false" | ||
rlRun "tmt run -rvvv plan --name /prepare-finish/user/inline" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Virtual, prepare/finish scripts with become=true" | ||
rlRun "tmt run -rvvv plan --name /prepare-finish/root/scripts" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Virtual, prepare/finish scripts with become=false" | ||
rlRun "tmt run -rvvv plan --name /prepare-finish/user/scripts" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartCleanup | ||
rlRun "popd" | ||
rlPhaseEnd | ||
fi | ||
rlJournalEnd |
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 @@ | ||
1 |
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,17 @@ | ||
summary: Basic smoke test | ||
provision: | ||
how: virtual | ||
image: fedora | ||
user: fedora | ||
become: true | ||
discover: | ||
tests: | ||
- name: Beakerlib test to generate report files on guest | ||
test: ./test.sh | ||
framework: beakerlib | ||
execute: | ||
how: tmt | ||
prepare: | ||
how: shell | ||
script: "echo 'umask 0027' >> /etc/profile; echo 'umask 0027' >> /etc/bashrc" | ||
|
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,21 @@ | ||
#!/bin/bash | ||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k | ||
. /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
||
rlJournalStart | ||
rlPhaseStartSetup | ||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" | ||
rlRun "pushd $tmp" | ||
rlRun "set -o pipefail" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest | ||
rlRun -s "echo HELLO > output" 0 "Say something" | ||
rlAssertGrep "HELLO" "output" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartCleanup | ||
rlRun "popd" | ||
rlRun "rm -r $tmp" 0 "Remove tmp directory" | ||
rlPhaseEnd | ||
rlJournalEnd |
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,2 @@ | ||
summary: Check that become works when instance umask is restricted | ||
description: Ensures that become works when used in virtual instances with umask set to 0027 like in hardened OSs. |
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,20 @@ | ||
#!/bin/bash | ||
. /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
||
PROVISION_METHODS=${PROVISION_METHODS:-virtual} | ||
|
||
rlJournalStart | ||
if [[ "$PROVISION_METHODS" =~ virtual ]]; then | ||
rlPhaseStartSetup | ||
rlRun "pushd data" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest "Test become=true with umask 0027" | ||
rlRun "tmt run -rvvv --all" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartCleanup | ||
rlRun "popd" | ||
rlPhaseEnd | ||
fi | ||
rlJournalEnd |