51 lines
1.5 KiB
Bash
51 lines
1.5 KiB
Bash
#!/usr/bin/env bats
|
|
# Pure mocked RPC receipts; this suite never contacts a node.
|
|
load '../lib/rpc.bash'
|
|
|
|
rpc_result() {
|
|
case "$1" in
|
|
server.get-state) printf '%s\n' "$FIXTURE_STATE" ;;
|
|
container-list) printf '%s\n' "$FIXTURE_CONTAINERS" ;;
|
|
*) return 99 ;;
|
|
esac
|
|
}
|
|
|
|
setup() {
|
|
FIXTURE_STATE='{"data":{"package-data":{}}}'
|
|
FIXTURE_CONTAINERS='[]'
|
|
}
|
|
|
|
@test "absent apps skip instead of installing" {
|
|
capture_lifecycle_installation immich
|
|
[ "$ARCHY_LIFECYCLE_INSTALLED" = 0 ]
|
|
require_lifecycle_installation
|
|
false # skip must not return to any lifecycle action
|
|
}
|
|
|
|
@test "durably installed missing container still qualifies" {
|
|
FIXTURE_STATE='{"data":{"package-data":{"immich":{"state":"installed"}}}}'
|
|
capture_lifecycle_installation immich
|
|
[ "$ARCHY_LIFECYCLE_INSTALLED" = 1 ]
|
|
FIXTURE_STATE='{"data":{"package-data":{}}}'
|
|
require_lifecycle_installation # admission survives the suite's own stop
|
|
}
|
|
|
|
@test "legacy container is installation evidence" {
|
|
FIXTURE_CONTAINERS='[{"name":"immich","state":"stopped"}]'
|
|
capture_lifecycle_installation immich
|
|
[ "$ARCHY_LIFECYCLE_INSTALLED" = 1 ]
|
|
}
|
|
|
|
@test "malformed inventory fails instead of skipping" {
|
|
FIXTURE_STATE='{}'
|
|
run capture_lifecycle_installation immich
|
|
[ "$status" -ne 0 ]
|
|
}
|
|
|
|
@test "not-installed catalog rows are not evidence" {
|
|
FIXTURE_STATE='{"data":{"package-data":{"immich":{"state":"not-installed"}}}}'
|
|
FIXTURE_CONTAINERS='[{"name":"immich","state":"not-installed"}]'
|
|
capture_lifecycle_installation immich
|
|
[ "$ARCHY_LIFECYCLE_INSTALLED" = 0 ]
|
|
}
|