diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/bin/rc-service | 9 | ||||
-rwxr-xr-x | tests/fake_rc_service_test | 21 |
2 files changed, 29 insertions, 1 deletions
diff --git a/tests/bin/rc-service b/tests/bin/rc-service index f6b570e..ca3ad28 100755 --- a/tests/bin/rc-service +++ b/tests/bin/rc-service @@ -102,6 +102,15 @@ case "$action" in restart) $prog --ifstarted $svc stop && $prog $svc start ;; + status) + if [ -e "$ROOT"/run/started/$svc ]; then + msg " * status: started" + exit 0 + else + msg " * status: stopped" + exit 3 + fi + ;; *) usage 1 esac diff --git a/tests/fake_rc_service_test b/tests/fake_rc_service_test index d62bbe9..68e0dc3 100755 --- a/tests/fake_rc_service_test +++ b/tests/fake_rc_service_test @@ -16,7 +16,9 @@ init_tests \ rc_service_ifstopped_start \ rc_service_ifstopped_stop \ rc_service_restart_stopped \ - rc_service_restart_started + rc_service_restart_started \ + rc_service_status_stopped \ + rc_service_status_started test_started() { test -e run/started/$1 || atf_fail "$1 was not started" @@ -185,3 +187,20 @@ rc_service_restart_stopped_body() { test_started foo } +rc_service_status_stopped_body() { + init_env + atf_check -s exit:3 \ + -o match:"status: stopped" \ + -e empty \ + rc-service foo status +} + +rc_service_status_started_body() { + init_env + rc-service --quiet foo start + atf_check -s exit:0 \ + -o match:"status: started" \ + -e empty \ + rc-service foo status +} + |