mirror of
https://github.com/troglobit/finit.git
synced 2026-11-08 16:11:10 +00:00
test: new regression test for initctl restart self
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
ccb84ced2e
commit
75c5c85f07
3 files changed
+87
-2
No files matched your search
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
# Verify that a service can restart itself, issue #280
|
||||
set -eu
|
||||
|
||||
TEST_DIR=$(dirname "$0")
|
||||
|
||||
test_setup()
|
||||
{
|
||||
say "Test start $(date)"
|
||||
texec sh -c "mkdir -p /etc/default"
|
||||
}
|
||||
|
||||
test_teardown()
|
||||
{
|
||||
say "Test done $(date)"
|
||||
say "Running test teardown."
|
||||
|
||||
texec rm -f "$FINIT_CONF"
|
||||
}
|
||||
|
||||
check_restarts()
|
||||
{
|
||||
assert "serv restarts" "$(texec cat "$1" | awk '{print $1;}')" -ge "$2"
|
||||
}
|
||||
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "$TEST_DIR/tenv/lib.sh"
|
||||
|
||||
say "Add stanza to $FINIT_CONF"
|
||||
texec sh -c "echo 'service serv -np -r serv -- Restart self' > $FINIT_CONF"
|
||||
|
||||
say 'Reload Finit'
|
||||
texec sh -c "initctl reload"
|
||||
|
||||
sleep 2
|
||||
texec sh -c "initctl status serv"
|
||||
texec sh -c "ps"
|
||||
|
||||
sleep 2
|
||||
texec sh -c "initctl status serv"
|
||||
texec sh -c "ps"
|
||||
|
||||
say 'Pending restarts by itself ...'
|
||||
retry 'check_restarts /tmp/serv-restart.cnt 3' 20 1
|
||||
|
||||
return 0
|
||||
Reference in new issue
Block a user