mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
test: Minor refactor to reduce test code duplication
Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
This commit is contained in:
@@ -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..."
|
||||
|
||||
@@ -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..."
|
||||
|
||||
Reference in New Issue
Block a user