diff options
Diffstat (limited to 'tests/run_cert_bootstrap_test.sh')
| -rwxr-xr-x | tests/run_cert_bootstrap_test.sh | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/tests/run_cert_bootstrap_test.sh b/tests/run_cert_bootstrap_test.sh index 681a4aa..d0f4a3e 100755 --- a/tests/run_cert_bootstrap_test.sh +++ b/tests/run_cert_bootstrap_test.sh @@ -15,6 +15,8 @@ # --------------------------------------------------------------- set -uo pipefail +source "$(dirname "$0")/test_helpers.sh" + CONFIG_DIR="${1:?Usage: $0 <config_dir>}" LDS_PORT=14840 @@ -23,7 +25,6 @@ LDS_PID="" SR_PID="" TMPFILE="" DOWNLOADED_CERT="" -FAILURES=0 # ── cleanup ──────────────────────────────────────────────────── cleanup() { @@ -35,44 +36,10 @@ cleanup() { } trap cleanup EXIT -# ── helpers ──────────────────────────────────────────────────── -wait_for_port() { - local port="$1" pid="$2" label="$3" i=0 - while [ $i -lt 50 ]; do - if ! kill -0 "$pid" 2>/dev/null; then - echo "FAIL: $label exited prematurely" - exit 1 - fi - if ss -tlnp 2>/dev/null | grep -q ":${port} "; then - return 0 - fi - sleep 0.1 - i=$((i + 1)) - done - echo "FAIL: $label did not listen on port $port within 5 s" - exit 1 -} - -check() { - local label="$1" result="$2" - if [ "$result" -eq 0 ]; then - echo "PASS: $label" - else - echo "FAIL: $label" - FAILURES=$((FAILURES + 1)) - fi -} - # ── idempotency guard ───────────────────────────────────────── rm -f "$CONFIG_DIR/certs/trust_client/ServerRegister_cert.der" -# ── port check ───────────────────────────────────────────────── -for port in $LDS_PORT $SR_PORT; do - if ss -tlnp 2>/dev/null | grep -q ":${port} "; then - echo "FAIL: port $port is already in use" - exit 1 - fi -done +assert_ports_free "$LDS_PORT" "$SR_PORT" # ── start LDS ────────────────────────────────────────────────── build/bobink_opcua_discovery_server "$CONFIG_DIR/server_lds.conf" >/dev/null 2>&1 & |
