mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-13 23:43:47 -05:00
bash settings in tests
This commit is contained in:
@@ -34,9 +34,17 @@ setup() {
|
||||
VERBOSE=false
|
||||
FORCE=false
|
||||
DRYRUN=false
|
||||
|
||||
set -o errtrace
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
}
|
||||
|
||||
teardown() {
|
||||
set +o nounset
|
||||
set +o errtrace
|
||||
set +o pipefail
|
||||
|
||||
popd >&2
|
||||
temp_del "${TESTDIR}"
|
||||
}
|
||||
@@ -131,6 +139,7 @@ teardown() {
|
||||
run info "testing info"
|
||||
run debug "testing debug"
|
||||
run fatal "testing fatal"
|
||||
set +o nounset
|
||||
|
||||
assert_file_exist "${LOGFILE}"
|
||||
run cat "${LOGFILE}"
|
||||
@@ -150,6 +159,7 @@ teardown() {
|
||||
run notice "testing notice"
|
||||
run info "testing info"
|
||||
run debug "testing debug"
|
||||
set +o nounset
|
||||
|
||||
assert_file_exist "${LOGFILE}"
|
||||
run cat "${LOGFILE}"
|
||||
@@ -169,7 +179,7 @@ teardown() {
|
||||
run notice "testing notice"
|
||||
run info "testing info"
|
||||
run debug "testing debug"
|
||||
|
||||
set +o nounset
|
||||
assert_file_exist "${LOGFILE}"
|
||||
run cat "${LOGFILE}"
|
||||
assert_line --index 0 --regexp "[0-9]+:[0-9]+:[0-9]+ \[ error\] \[.*\] testing error"
|
||||
@@ -188,7 +198,7 @@ teardown() {
|
||||
run notice "testing notice"
|
||||
run info "testing info"
|
||||
run debug "testing debug"
|
||||
|
||||
set +o nounset
|
||||
assert_file_exist "${LOGFILE}"
|
||||
run cat "${LOGFILE}"
|
||||
assert_line --index 0 --regexp "[0-9]+:[0-9]+:[0-9]+ \[ error\] \[.*\] testing error"
|
||||
@@ -207,7 +217,7 @@ teardown() {
|
||||
run notice "testing notice"
|
||||
run info "testing info"
|
||||
run debug "testing debug"
|
||||
|
||||
set +o nounset
|
||||
assert_file_exist "${LOGFILE}"
|
||||
run cat "${LOGFILE}"
|
||||
assert_line --index 0 --regexp "[0-9]+:[0-9]+:[0-9]+ \[ error\] \[.*\] testing error"
|
||||
|
||||
Reference in New Issue
Block a user