Files
light-heart-labs--dreamserver/ods/tests/test-windows-missing-service-hints.sh
T
wehub-resource-sync 9e8f1bbeed
Dashboard / frontend (push) Failing after 0s
Dashboard / api (push) Failing after 0s
Lint PowerShell / powershell-lint (ubuntu-latest) (push) Failing after 1s
Python Lint / Lint Python with Ruff (push) Failing after 1s
ShellCheck / Lint shell scripts (push) Failing after 1s
Matrix Smoke / linux-smoke (push) Failing after 1s
Matrix Smoke / distro: cachyos (push) Failing after 15s
Matrix Smoke / distro: linux-mint-21.3 (push) Failing after 15s
Matrix Smoke / distro: debian-12 (push) Failing after 5m21s
Matrix Smoke / distro: fedora-41 (push) Failing after 4m56s
Matrix Smoke / distro: ubuntu-24.04 (push) Failing after 2m13s
Matrix Smoke / distro: rocky-9 (push) Failing after 10m39s
Matrix Smoke / distro: manjaro (push) Failing after 12m11s
Matrix Smoke / distro: opensuse-tw (push) Failing after 11m53s
Matrix Smoke / distro: archlinux (push) Failing after 20m3s
Matrix Smoke / distro: ubuntu-22.04 (push) Failing after 13m49s
Validate .env Schema / tier-1-env-validation (push) Successful in 52s
Validate .env Schema / tier-2-env-validation (push) Successful in 44s
Validate .env Schema / tier-3-env-validation (push) Successful in 52s
Validate .env Schema / tier-4-env-validation (push) Successful in 51s
Validate Extensions Catalog / Check catalog is up-to-date (push) Failing after 9m47s
Secret Scan / Scan for secrets (push) Failing after 21m4s
Validate Docker Compose / Validate Docker Compose files (push) Has been cancelled
Python Type Check / Type check with mypy (push) Has been cancelled
Validate .env Schema / tier-0-env-validation (push) Has been cancelled
Test Linux / integration-smoke (push) Has been cancelled
Lint PowerShell / powershell-lint (windows-latest) (push) Has been cancelled
Matrix Smoke / macos-smoke (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:31:33 +08:00

69 lines
2.6 KiB
Bash

#!/bin/bash
# ============================================================================
# ODS Windows missing compose service hint tests
# ============================================================================
# Static checks for friendly Windows CLI errors when an optional service is not
# present in the active .compose-flags stack.
# ============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
ODS_PS1="$ROOT_DIR/installers/windows/ods.ps1"
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
PASS=0
FAIL=0
pass() { echo -e " ${GREEN}PASS${NC} $1"; PASS=$((PASS + 1)); }
fail() { echo -e " ${RED}FAIL${NC} $1"; FAIL=$((FAIL + 1)); }
check() {
local pattern="$1" file="$2" label="$3"
if grep -Fq -- "$pattern" "$file"; then
pass "$label"
else
fail "$label"
fi
}
echo ""
echo "=== Windows missing compose service hint tests ==="
echo ""
[[ -f "$ODS_PS1" ]] && pass "ods.ps1 exists" || fail "ods.ps1 missing"
check 'function Write-ODSMissingComposeServiceHint' "$ODS_PS1" "missing-service hint helper exists"
check "Service '\$Service' is not in the active ODS compose stack." "$ODS_PS1" "hint explains service is absent from active stack"
check 'compose.yaml.disabled' "$ODS_PS1" "hint checks disabled extension compose fragment"
check 'active .compose-flags stack does not include it' "$ODS_PS1" "hint explains stale/mismatched compose flags"
check 'n8n is optional. Install with -Workflows or -All' "$ODS_PS1" "hint gives n8n/workflows remediation"
check 'docker compose @flags config --services' "$ODS_PS1" "hint prints diagnostic compose-services command"
guard_count=$(grep -Fc 'Write-ODSMissingComposeServiceHint -ComposeFlags $flags -Service $Service' "$ODS_PS1" || true)
if [[ "$guard_count" -ge 4 ]]; then
pass "start/stop/restart/logs guard missing services before docker compose"
else
fail "expected missing-service guard in start/stop/restart/logs, found $guard_count"
fi
logs_block="$(awk '
/function Invoke-Logs/ { in_block=1 }
in_block { print }
in_block && /function Invoke-ConfigShow/ { exit }
' "$ODS_PS1")"
if grep -Fq 'Test-ODSComposeServiceAvailable -ComposeFlags $flags -Service $Service' <<<"$logs_block" &&
grep -Fq 'Write-ODSMissingComposeServiceHint -ComposeFlags $flags -Service $Service' <<<"$logs_block"; then
pass "logs command checks compose service availability before tailing logs"
else
fail "logs command does not guard missing services before tailing logs"
fi
echo ""
echo "Result: $PASS passed, $FAIL failed"
[[ $FAIL -eq 0 ]]