mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
test: actually verify the service asserts ready before continuing
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
d66455496a
commit
2d9c63e48e
2 files changed
+16
-4
No files matched your search
@@ -96,6 +96,14 @@ assert_nocond()
|
|||||||
assert "Condition $cond cleared" "$(texec initctl -v cond get "$cond")" = "off"
|
assert "Condition $cond cleared" "$(texec initctl -v cond get "$cond")" = "off"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert_ready()
|
||||||
|
{
|
||||||
|
srv=$1
|
||||||
|
cond="service/$srv/ready"
|
||||||
|
|
||||||
|
assert "$cond asserted" "$(texec initctl cond dump |grep "<$cond>" |awk '{print $3}')" = "on"
|
||||||
|
}
|
||||||
|
|
||||||
assert_is_pidfile()
|
assert_is_pidfile()
|
||||||
{
|
{
|
||||||
assert "Process has PID file: $2" "$(texec initctl -p status "$1" | awk '/PID file/{print $4}')" = "$2"
|
assert "Process has PID file: $2" "$(texec initctl -p status "$1" | awk '/PID file/{print $4}')" = "$2"
|
||||||
|
|||||||
+8
-4
@@ -19,9 +19,10 @@ test_teardown()
|
|||||||
|
|
||||||
test_one()
|
test_one()
|
||||||
{
|
{
|
||||||
service=$1
|
service=$(echo "$1" | tr -s " ")
|
||||||
file=/tmp/ready
|
file=/tmp/ready
|
||||||
|
|
||||||
|
sep
|
||||||
say "Add service stanza '$service' to $FINIT_CONF ..."
|
say "Add service stanza '$service' to $FINIT_CONF ..."
|
||||||
run "echo '$service' > $FINIT_CONF"
|
run "echo '$service' > $FINIT_CONF"
|
||||||
|
|
||||||
@@ -29,6 +30,9 @@ test_one()
|
|||||||
run "initctl reload"
|
run "initctl reload"
|
||||||
|
|
||||||
retry 'assert_num_children 1 serv'
|
retry 'assert_num_children 1 serv'
|
||||||
|
retry 'assert_ready "serv"' 5 1
|
||||||
|
# run "initctl status"
|
||||||
|
# run "initctl cond dump"
|
||||||
assert_file_contains "$file" "READY"
|
assert_file_contains "$file" "READY"
|
||||||
run "rm -f $file"
|
run "rm -f $file"
|
||||||
|
|
||||||
@@ -46,6 +50,6 @@ test_one()
|
|||||||
|
|
||||||
#run "initctl debug"
|
#run "initctl debug"
|
||||||
|
|
||||||
test_one "service ready:/bin/ready.sh serv -np -- Native style notification"
|
test_one "service ready:/bin/ready.sh serv -np -- Native PID style notification"
|
||||||
test_one "service notify:s6 ready:/bin/ready.sh serv -np -N %n -- s6 style notification"
|
test_one "service notify:s6 ready:/bin/ready.sh serv -n -N %n -- s6 style notification"
|
||||||
test_one "service notify:systemd ready:/bin/ready.sh serv -np -- systemd style notification"
|
test_one "service notify:systemd ready:/bin/ready.sh serv -n -- systemd style notification"
|
||||||
Reference in new issue
Block a user