orchestra: pre-release WIP snapshot (orchestra-06g4ft0mb733h2zcz237wfhfd8-b318f8b5)
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
local quiet=
|
local quiet=
|
||||||
|
local json=
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
if [ "$arg" = --help ]; then
|
if [ "$arg" = --help ]; then
|
||||||
printf 'Usage: %s [--quiet]\n\n' "${0##*/}"
|
printf 'Usage: %s [--quiet]\n\n' "${0##*/}"
|
||||||
@@ -11,9 +12,16 @@ main() {
|
|||||||
exit 0
|
exit 0
|
||||||
elif [ "$arg" = --quiet ]; then
|
elif [ "$arg" = --quiet ]; then
|
||||||
quiet=1
|
quiet=1
|
||||||
|
elif [ "$arg" = --json ]; then
|
||||||
|
json=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -n "$json" ]; then
|
||||||
|
printf '{"status":"ok","checks":1}\n'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
[ -n "$quiet" ] || printf 'OK - all healthchecks passed\n'
|
[ -n "$quiet" ] || printf 'OK - all healthchecks passed\n'
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+34
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Self-test for the Orchestra E2E healthcheck.
|
||||||
|
|
||||||
|
here=$(cd "$(dirname "$0")" && pwd)
|
||||||
|
healthcheck="$here/orchestra_e2e_healthcheck.sh"
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
printf 'selftest: FAILED %s\n' "$1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# plain run
|
||||||
|
out=$(bash "$healthcheck")
|
||||||
|
status=$?
|
||||||
|
|
||||||
|
[ "$status" -eq 0 ] || fail "plain run exit status: want 0, got $status"
|
||||||
|
case "$out" in
|
||||||
|
*OK*) ;;
|
||||||
|
*) fail "plain run stdout contains OK: got '$out'" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# --json run
|
||||||
|
jout=$(bash "$healthcheck" --json)
|
||||||
|
jstatus=$?
|
||||||
|
|
||||||
|
[ "$jstatus" -eq 0 ] || fail "--json run exit status: want 0, got $jstatus"
|
||||||
|
jlines=$(printf '%s\n' "$jout" | wc -l)
|
||||||
|
[ "$jlines" -eq 1 ] || fail "--json run line count: want 1, got $jlines"
|
||||||
|
case "$jout" in
|
||||||
|
'{"status":'*) ;;
|
||||||
|
*) fail "--json run stdout prefix: want {\"status\": got '$jout'" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
printf 'selftest: ok\n'
|
||||||
Reference in New Issue
Block a user