-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: account for system and vendor scripts
Amend the existing scripts to verify the expected behaviors for greenboot check|green|red invocations when scripts are provided in /usr/lib/greenboot/ and /etc/greenboot. This slightly extends the checks by verifying the test scritps from both vendor and system-specific sources are called during tests of greenboot check, red and green commands. Signed-off-by: Eric Chanudet <[email protected]>
- Loading branch information
Showing
5 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,20 +1,26 @@ | ||
load common.bash | ||
|
||
function setup() { | ||
mkdir -p $GREENBOOT_DEFAULT_CHECK_PATH $GREENBOOT_ETC_CHECK_PATH | ||
|
||
# 02_watchdog.sh can't be checked within the container at the moment | ||
# due to rpm-ostree, hence moving it out of the required directory | ||
# for this test | ||
mv $GREENBOOT_DEFAULT_CHECK_PATH/required.d/02_watchdog.sh /tmp/02_watchdog.sh | ||
|
||
cp testing_files/10_failing_check.sh $GREENBOOT_DEFAULT_CHECK_PATH/wanted.d/ | ||
cp testing_files/10_failing_check.sh $GREENBOOT_DEFAULT_CHECK_PATH/wanted.d/10_failing_check.sh | ||
cp testing_files/10_failing_check.sh $GREENBOOT_ETC_CHECK_PATH/wanted.d/20_failing_check.sh | ||
} | ||
|
||
@test "Test greenboot check with wanted scripts failing" { | ||
run $GREENBOOT_BIN_PATH check | ||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"10_failing_check.sh"* ]] | ||
[[ "$output" == *"20_failing_check.sh"* ]] | ||
} | ||
|
||
function teardown() { | ||
rm $GREENBOOT_DEFAULT_CHECK_PATH/wanted.d/10_failing_check.sh | ||
rm $GREENBOOT_ETC_CHECK_PATH/wanted.d/20_failing_check.sh | ||
mv /tmp/02_watchdog.sh $GREENBOOT_DEFAULT_CHECK_PATH/required.d/02_watchdog.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 |
---|---|---|
@@ -1,16 +1,20 @@ | ||
load common.bash | ||
|
||
function setup() { | ||
mkdir -p $GREENBOOT_GREEN_PATH | ||
cp testing_files/20_green_script.sh $GREENBOOT_GREEN_PATH/ | ||
mkdir -p $GREENBOOT_DEFAULT_GREEN_PATH $GREENBOOT_ETC_GREEN_PATH | ||
cp testing_files/20_green_script.sh $GREENBOOT_DEFAULT_GREEN_PATH/20_green_script.sh | ||
cp testing_files/20_green_script.sh $GREENBOOT_ETC_GREEN_PATH/30_green_script.sh | ||
} | ||
|
||
@test "Test greenboot green command" { | ||
run $GREENBOOT_BIN_PATH green | ||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"Health Check SUCCESS"* ]] | ||
[[ "$output" == *"20_green_script.sh"* ]] | ||
[[ "$output" == *"30_green_script.sh"* ]] | ||
} | ||
|
||
function teardown() { | ||
rm $GREENBOOT_GREEN_PATH/20_green_script.sh | ||
rm $GREENBOOT_DEFAULT_GREEN_PATH/20_green_script.sh | ||
rm $GREENBOOT_ETC_GREEN_PATH/30_green_script.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 |
---|---|---|
@@ -1,16 +1,20 @@ | ||
load common.bash | ||
|
||
function setup() { | ||
mkdir -p $GREENBOOT_RED_PATH | ||
cp testing_files/30_red_script.sh $GREENBOOT_RED_PATH/ | ||
mkdir -p $GREENBOOT_DEFAULT_RED_PATH $GREENBOOT_ETC_RED_PATH | ||
cp testing_files/30_red_script.sh $GREENBOOT_DEFAULT_RED_PATH/30_red_script.sh | ||
cp testing_files/30_red_script.sh $GREENBOOT_ETC_RED_PATH/40_red_script.sh | ||
} | ||
|
||
@test "Test greenboot red command" { | ||
run $GREENBOOT_BIN_PATH red | ||
[ "$status" -eq 0 ] | ||
[[ "$output" == *"Health Check FAILURE"* ]] | ||
[[ "$output" == *"30_red_script.sh"* ]] | ||
[[ "$output" == *"40_red_script.sh"* ]] | ||
} | ||
|
||
function teardown() { | ||
rm $GREENBOOT_RED_PATH/30_red_script.sh | ||
rm $GREENBOOT_DEFAULT_RED_PATH/30_red_script.sh | ||
rm $GREENBOOT_ETC_RED_PATH/40_red_script.sh | ||
} |