test: Minor adjustments to improve consistency between test code structure

Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
This commit is contained in:
Magnus Malm committed 2021-02-24 13:20:13 +01:00
1 parent f214098560
commit 2c055cb954
5 files changed
+39 -23

No files matched your search

@@ -3,28 +3,30 @@
set -eu
TEST_DIR=$(dirname "$0")/..
TESTENV_ROOT="$TEST_DIR"/test_root
# shellcheck source=/dev/null
. "$TEST_DIR/lib.sh"
test_teardown() {
say "Test done $(date)"
say "Running test teardown..."
say "Running test teardown."
# Teardown
rm -f test_root/bin/service.sh
remove_thing "$TESTENV_ROOT/$FINIT_CONF_DIR/service.conf"
remove_thing "$TESTENV_ROOT"/test_assets/service.sh
}
# Test
say "Test start $(date)"
say "Add a dynamic service in $FINIT_CONF_DIR/service.conf"
cp "$TEST_DIR"/common/service.sh "$TEST_DIR"/test_root/test_assets/
say "Add a dynamic service in $FINIT_CONF_DIR/service.conf"
texec sh -c "echo 'service [2345] kill:20 log /test_assets/service.sh' > $FINIT_CONF_DIR/service.conf"
say 'Reload Finit'
texec kill -SIGHUP 1
retry 'assert_num_children 1 service.sh' 5
retry 'assert_num_children 1 service.sh'
say 'Remove the dynamic service from /etc/finit.d/service.conf'
texec sh -c "echo > $FINIT_CONF_DIR/service.conf"
@@ -32,4 +34,4 @@ texec sh -c "echo > $FINIT_CONF_DIR/service.conf"
say 'Reload Finit'
texec kill -SIGHUP 1
retry 'assert_num_children 0 service.sh' 5
retry 'assert_num_children 0 service.sh'