mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00:00
test: regression test to reproduce issue #392
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
6cc587068b
commit
77cf72cb40
2 files changed
+68
No files matched your search
@@ -38,6 +38,7 @@ EXTRA_DIST += initctl-status-subset.sh
|
|||||||
EXTRA_DIST += notify.sh
|
EXTRA_DIST += notify.sh
|
||||||
EXTRA_DIST += pidfile.sh
|
EXTRA_DIST += pidfile.sh
|
||||||
EXTRA_DIST += pre-post-serv.sh
|
EXTRA_DIST += pre-post-serv.sh
|
||||||
|
EXTRA_DIST += process-depends.sh
|
||||||
EXTRA_DIST += rclocal.sh
|
EXTRA_DIST += rclocal.sh
|
||||||
EXTRA_DIST += ready-serv.sh
|
EXTRA_DIST += ready-serv.sh
|
||||||
EXTRA_DIST += restart-self.sh
|
EXTRA_DIST += restart-self.sh
|
||||||
@@ -83,6 +84,7 @@ TESTS += initctl-status-subset.sh
|
|||||||
TESTS += notify.sh
|
TESTS += notify.sh
|
||||||
TESTS += pidfile.sh
|
TESTS += pidfile.sh
|
||||||
TESTS += pre-post-serv.sh
|
TESTS += pre-post-serv.sh
|
||||||
|
TESTS += process-depends.sh
|
||||||
TESTS += rclocal.sh
|
TESTS += rclocal.sh
|
||||||
TESTS += ready-serv.sh
|
TESTS += ready-serv.sh
|
||||||
TESTS += restart-self.sh
|
TESTS += restart-self.sh
|
||||||
|
|||||||
Executable
+66
@@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Regression test for issue #392
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
#set -x
|
||||||
|
|
||||||
|
TEST_DIR=$(dirname "$0")
|
||||||
|
|
||||||
|
test_setup()
|
||||||
|
{
|
||||||
|
say "Test start $(date)"
|
||||||
|
run "mkdir -p /etc/default"
|
||||||
|
}
|
||||||
|
|
||||||
|
test_teardown()
|
||||||
|
{
|
||||||
|
say "Test done $(date)"
|
||||||
|
say "Running test teardown."
|
||||||
|
|
||||||
|
run "rm -f $FINIT_CONF"
|
||||||
|
}
|
||||||
|
|
||||||
|
srv()
|
||||||
|
{
|
||||||
|
say "Adding service $(echo "$1" | sed -n -e 's/^.*-- //p')"
|
||||||
|
run "echo '$1' >> $FINIT_CONF"
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. "$TEST_DIR/lib/setup.sh"
|
||||||
|
|
||||||
|
#run "initctl debug"
|
||||||
|
|
||||||
|
# Test systemd notify
|
||||||
|
srv 'service name:test1_systemd [2345] notify:systemd restart:0 serv -i test1 -n -- Systemd proc'
|
||||||
|
srv 'service name:test2 [2345] <service/test1_systemd/ready> serv -i test2 -np -- Dependency test 1'
|
||||||
|
|
||||||
|
# Test pid notify
|
||||||
|
srv "service name:test3_pid [2345] notify:pid <service/test1_systemd/ready> serv -i test3 -np -- Dependency test 2"
|
||||||
|
srv "service name:test4 [2345] <service/test3_pid/ready> serv -i test4 -np -- Dependency test 3"
|
||||||
|
|
||||||
|
sep "$FINIT_CONF"
|
||||||
|
run "cat $FINIT_CONF"
|
||||||
|
sep
|
||||||
|
|
||||||
|
say 'Reload Finit'
|
||||||
|
run "initctl reload"
|
||||||
|
|
||||||
|
say "Waiting for all services to start"
|
||||||
|
retry 'assert_status "test4" "running"' 5 1
|
||||||
|
|
||||||
|
# Load bearing debug. Without this the bug cannot be reproduced!
|
||||||
|
run "initctl debug"
|
||||||
|
|
||||||
|
sep
|
||||||
|
say "Stopping root service, all others should also stop"
|
||||||
|
run "initctl stop test1_systemd"
|
||||||
|
retry 'assert_status "test3_pid" "waiting"' 5 1
|
||||||
|
|
||||||
|
sep
|
||||||
|
say "Verify test4 does not restart"
|
||||||
|
run "initctl status"
|
||||||
|
run "initctl cond dump"
|
||||||
|
assert_status "test4" "waiting"
|
||||||
|
|
||||||
|
return 0
|
||||||
Reference in new issue
Block a user