test: Minor refactor to reduce test code duplication

Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
This commit is contained in:
Magnus Malm
2021-02-24 13:13:38 +01:00
parent 6027e94c65
commit f214098560
5 changed files with 4 additions and 16 deletions
+4
View File
@@ -1,5 +1,9 @@
#!/bin/sh
assert_num_children() {
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
}
texec() {
# shellcheck disable=SC2154
"$TEST_DIR/testenv_exec.sh" "$finit_pid" "$@"
@@ -6,10 +6,6 @@ TEST_DIR=$(dirname "$0")/..
# shellcheck source=/dev/null
. "$TEST_DIR/lib.sh"
assert_num_children() {
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
}
test_teardown() {
say "Test done $(date)"
say "Running test teardown..."
@@ -6,10 +6,6 @@ TEST_DIR=$(dirname "$0")/..
# shellcheck source=/dev/null
. "$TEST_DIR/lib.sh"
assert_num_children() {
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
}
test_teardown() {
say "Test done $(date)"
say "Running test teardown..."
-4
View File
@@ -6,10 +6,6 @@ TEST_DIR=$(dirname "$0")/..
# shellcheck source=/dev/null
. "$TEST_DIR/lib.sh"
assert_num_children() {
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
}
test_teardown() {
say "Test done $(date)"
say "Running test teardown..."
@@ -6,10 +6,6 @@ TEST_DIR=$(dirname "$0")/..
# shellcheck source=/dev/null
. "$TEST_DIR/lib.sh"
assert_num_children() {
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
}
test_teardown() {
say "Test done $(date)"
say "Running test teardown..."