-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge cli flags after hot reload: add coverage
Signed-off-by: Lenka Segura <lsegura@redhat.com>
- Loading branch information
Showing
4 changed files
with
82 additions
and
13 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
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,48 @@ | ||
#!/usr/bin/env bats | ||
# vim: set syntax=sh: | ||
|
||
load helpers | ||
|
||
function setup() { | ||
setup_test | ||
start_crio_no_log_level | ||
|
||
# the default log_level is `error` so we have to adapt it before running | ||
# any tests to be able to see the `info` messages | ||
replace_config "log_level" "debug" | ||
} | ||
|
||
function teardown() { | ||
rm -f "$CRIO_CONFIG_DIR/00-new*Runtime.conf" | ||
cleanup_test | ||
} | ||
|
||
function expect_log_success() { | ||
wait_for_log '"set config '"$1"' to \\"'"$2"'\\""' | ||
} | ||
|
||
function expect_log_failure() { | ||
wait_for_log "unable to reload configuration: $1" | ||
} | ||
|
||
@test "reload config should succeed with 'log_level'" { | ||
# given | ||
NEW_LEVEL="warn" | ||
OPTION="log_level" | ||
|
||
# when | ||
replace_config $OPTION $NEW_LEVEL | ||
reload_crio | ||
|
||
# then | ||
expect_log_success $OPTION $NEW_LEVEL | ||
} | ||
|
||
@test "reload config should fail with 'log_level' if invalid" { | ||
# when | ||
replace_config "log_level" "invalid" | ||
reload_crio | ||
|
||
# then | ||
expect_log_failure "not a valid logrus Level" | ||
} |