Files
finit/test/add-remove-dynamic-service-sub-config.sh
T
Joachim Wiberg 7f8a96a73e test: refactor test framework to use a rootfs skeleton
Instead of having to create files, and copying them in place for each
test, we move all static test files to a skeleton rootfs.  This makes
it a lot easier to get an overview of how things and how they work.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-08 07:22:33 +02:00

35 lines
693 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."
texec rm -f "$FINIT_RCSD/service.conf"
}
say "Test start $(date)"
say "Add a dynamic service in $FINIT_RCSD/service.conf"
texec sh -c "echo 'service [2345] kill:20 log service.sh -- Dyn serv' > $FINIT_RCSD/service.conf"
say 'Reload Finit'
texec sh -c "initctl reload"
retry 'assert_num_children 1 service.sh'
say 'Remove the dynamic service from /etc/finit.d/service.conf'
texec sh -c "echo > $FINIT_RCSD/service.conf"
say 'Reload Finit'
texec sh -c "initctl reload"
retry 'assert_num_children 0 service.sh'