Files
finit/test/start-stop-service.sh
T
2023-02-05 11:22:26 +01:00

37 lines
635 B
Bash
Executable File

#!/bin/sh
set -eu
TEST_DIR=$(dirname "$0")
# shellcheck source=/dev/null
. "$TEST_DIR/tenv/lib.sh"
test_teardown()
{
say "Test done $(date)"
say "Running test teardown."
run "rm -f $FINIT_CONF"
}
say "Test start $(date)"
say "Add service stanza in $FINIT_CONF"
run "echo 'service [2345] kill:20 log service.sh -- Test service' > $FINIT_CONF"
say 'Reload Finit'
run "initctl reload"
retry 'assert_num_children 1 service.sh'
say 'Stop the service'
run "initctl stop service.sh"
retry 'assert_num_children 0 service.sh'
say 'Start the service again'
run "initctl start service.sh"
retry 'assert_num_children 1 service.sh'