mirror of
https://github.com/troglobit/finit.git
synced 2026-10-30 12:50:34 +00:00
initctl: the status views over D-Bus
The summary table, the per-service detail, JSON and the quiet and ident forms all read state Finit already publishes, so they read it from the bus like everything else rather than through a second path that has to be kept in step. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
ebc0ef62e6
commit
6310d9e760
16 files changed
+1271
-315
No files matched your search
@@ -94,3 +94,51 @@ say "initctl reload <svc> routes through Service1.Reload"
|
||||
texec initctl reload keventd >/dev/null \
|
||||
|| fail "initctl reload keventd returned non-zero"
|
||||
assert "Per-service reload ok" 0 -eq 0
|
||||
|
||||
say "initctl status views render over D-Bus alone"
|
||||
# hide the legacy socket: everything below must come over the bus
|
||||
texec mv /run/finit/socket /run/finit/socket.hidden
|
||||
|
||||
set +e
|
||||
out=$(texec initctl -p status)
|
||||
status_rc=$?
|
||||
one=$(texec initctl -p status keventd)
|
||||
one_rc=$?
|
||||
texec initctl -q status keventd
|
||||
quiet_rc=$?
|
||||
jout=$(texec initctl -j status)
|
||||
json_rc=$?
|
||||
idout=$(texec initctl ident)
|
||||
ident_rc=$?
|
||||
set -e
|
||||
|
||||
texec mv /run/finit/socket.hidden /run/finit/socket
|
||||
|
||||
assert "status table ok without legacy socket (rc=$status_rc)" \
|
||||
"$status_rc" -eq 0
|
||||
case "$out" in
|
||||
*keventd*running*) assert "keventd running in table" 0 -eq 0 ;;
|
||||
*) fail "keventd/running missing from status table" ;;
|
||||
esac
|
||||
|
||||
assert "status detail view ok (rc=$one_rc)" "$one_rc" -eq 0
|
||||
case "$one" in
|
||||
*"Status : running"*"Identity : keventd"*"Restarts :"*)
|
||||
assert "detail view fields present" 0 -eq 0 ;;
|
||||
*) fail "detail view incomplete: $one" ;;
|
||||
esac
|
||||
|
||||
assert "quiet mode exit code (rc=$quiet_rc)" "$quiet_rc" -eq 0
|
||||
|
||||
assert "json mode ok (rc=$json_rc)" "$json_rc" -eq 0
|
||||
case "$jout" in
|
||||
*'"identity": "keventd"'*'"status": "running"'*)
|
||||
assert "json fields present" 0 -eq 0 ;;
|
||||
*) fail "json output incomplete: $jout" ;;
|
||||
esac
|
||||
|
||||
assert "ident ok (rc=$ident_rc)" "$ident_rc" -eq 0
|
||||
case "$idout" in
|
||||
*keventd*) assert "ident lists keventd" 0 -eq 0 ;;
|
||||
*) fail "ident missing keventd" ;;
|
||||
esac
|
||||
Reference in new issue
Block a user