mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
test: Minor refactor to reduce test code duplication
Signed-off-by: Magnus Malm <magnusmalm@gmail.com>
This commit is contained in:
1 parent
6027e94c65
commit
f214098560
5 files changed
+4
-16
No files matched your search
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
assert_num_children() {
|
||||||
|
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
|
||||||
|
}
|
||||||
|
|
||||||
texec() {
|
texec() {
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
"$TEST_DIR/testenv_exec.sh" "$finit_pid" "$@"
|
"$TEST_DIR/testenv_exec.sh" "$finit_pid" "$@"
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ TEST_DIR=$(dirname "$0")/..
|
|||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. "$TEST_DIR/lib.sh"
|
. "$TEST_DIR/lib.sh"
|
||||||
|
|
||||||
assert_num_children() {
|
|
||||||
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
test_teardown() {
|
test_teardown() {
|
||||||
say "Test done $(date)"
|
say "Test done $(date)"
|
||||||
say "Running test teardown..."
|
say "Running test teardown..."
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ TEST_DIR=$(dirname "$0")/..
|
|||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. "$TEST_DIR/lib.sh"
|
. "$TEST_DIR/lib.sh"
|
||||||
|
|
||||||
assert_num_children() {
|
|
||||||
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
test_teardown() {
|
test_teardown() {
|
||||||
say "Test done $(date)"
|
say "Test done $(date)"
|
||||||
say "Running test teardown..."
|
say "Running test teardown..."
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ TEST_DIR=$(dirname "$0")/..
|
|||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. "$TEST_DIR/lib.sh"
|
. "$TEST_DIR/lib.sh"
|
||||||
|
|
||||||
assert_num_children() {
|
|
||||||
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
test_teardown() {
|
test_teardown() {
|
||||||
say "Test done $(date)"
|
say "Test done $(date)"
|
||||||
say "Running test teardown..."
|
say "Running test teardown..."
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ TEST_DIR=$(dirname "$0")/..
|
|||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
. "$TEST_DIR/lib.sh"
|
. "$TEST_DIR/lib.sh"
|
||||||
|
|
||||||
assert_num_children() {
|
|
||||||
assert "$1 services are running" "$(texec pgrep -P 1 "$2" | wc -l)" -eq "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
test_teardown() {
|
test_teardown() {
|
||||||
say "Test done $(date)"
|
say "Test done $(date)"
|
||||||
say "Running test teardown..."
|
say "Running test teardown..."
|
||||||
|
|||||||
Reference in new issue
Block a user