mirror of
https://github.com/troglobit/finit.git
synced 2026-11-21 19:51:46 +00:00
test: new regression test for issue #351
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
bdaf3370d4
commit
13dddb6912
4 files changed
+73
No files matched your search
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
# Regression test for issue #351 - verify that a dirty run/task in
|
||||
# runlevel S is not restarted forever jus because it exits with a
|
||||
# non-zero error code.
|
||||
set -eu
|
||||
|
||||
#export DEBUG=true
|
||||
TEST_DIR=$(dirname "$0")
|
||||
|
||||
test_setup()
|
||||
{
|
||||
say "Test start $(date)"
|
||||
run "mkdir -p /etc/default"
|
||||
export TEST_TIMEOUT=5
|
||||
}
|
||||
|
||||
test_teardown()
|
||||
{
|
||||
say "Test done $(date)"
|
||||
|
||||
say "Running test teardown."
|
||||
run "rm -f $FINIT_CONF"
|
||||
}
|
||||
|
||||
check_restarts()
|
||||
{
|
||||
assert "serv restarts" "$(texec cat "$1" | awk '{print $1;}')" -ge "$2"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "$TEST_DIR/lib/setup.sh"
|
||||
|
||||
test_one()
|
||||
{
|
||||
num=$1
|
||||
|
||||
say "Reloading Finit ..."
|
||||
run "initctl reload"
|
||||
# run "initctl status fail.sh"
|
||||
|
||||
say "Reloading Finit ..."
|
||||
run "initctl reload"
|
||||
# run "initctl status fail.sh"
|
||||
|
||||
assert_restart_cnt "$num/10" fail.sh
|
||||
}
|
||||
|
||||
sep
|
||||
say "Add stanza to $FINIT_CONF"
|
||||
run "echo 'run fail.sh -- Failure' > $FINIT_RCSD/fail.conf"
|
||||
run "echo 'run initctl touch fail' > $FINIT_RCSD/touch.conf"
|
||||
test_one 2
|
||||
|
||||
sep
|
||||
say "Changing runlevel ..."
|
||||
run "initctl runlevel 3"
|
||||
test_one 4
|
||||
|
||||
return 0
|
||||
Reference in new issue
Block a user