disposable_test_guard.sh #1

  • //
  • guest/
  • russell_jackson/
  • sdp/
  • test/
  • disposable_test_guard.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
# Sourced by the destructive test tools. This file never performs server actions.
sdp_test_error() { printf 'Disposable test guard: %s\n' "$*" >&2; return 1; }

sdp_test_validate_args() {
   [[ "$TEST_ROOT" =~ ^/[A-Za-z0-9_./-]+/sdp-test-[A-Za-z0-9_-]+$ && "$TEST_ROOT" != *'/../'* && "$TEST_ROOT" != *'/./'* ]] || {
      sdp_test_error 'root must be an absolute path ending in /sdp-test-NAME (no spaces, . or .. components).'; return 1;
   }
   [[ "$INSTANCE" =~ ^[A-Za-z0-9_-]+$ ]] || { sdp_test_error 'an explicit valid instance is required.'; return 1; }
   [[ "$TEST_PORT" =~ ^[0-9]+$ ]] && (( 10#$TEST_PORT >= 1024 && 10#$TEST_PORT <= 65535 )) || {
      sdp_test_error 'port must be an explicit unprivileged numeric port.'; return 1;
   }
   [[ "$TEST_OSUSER" =~ ^[a-z_][a-z0-9_-]*$ ]] || { sdp_test_error 'an explicit OS account is required.'; return 1; }
}

sdp_test_marker_text() {
   printf 'SDP_DISPOSABLE_V1\n%s\n%s\n%s\n%s\nsdp-test-%s\n' "$TEST_ROOT" "$INSTANCE" "$TEST_PORT" "$TEST_OSUSER" "$INSTANCE"
}

sdp_test_validate_marker() {
   local physical marker
   sdp_test_validate_args || return 1
   [[ -d "$TEST_ROOT" && ! -L "$TEST_ROOT" ]] || { sdp_test_error 'root must be a real directory.'; return 1; }
   physical=$(cd "$TEST_ROOT" && pwd -P) || return 1
   [[ "$physical" == "$TEST_ROOT" ]] || { sdp_test_error 'root must not contain symlink components.'; return 1; }
   marker="$TEST_ROOT/.sdp-disposable-test"
   [[ -f "$marker" && ! -L "$marker" ]] || { sdp_test_error 'disposable marker is missing.'; return 1; }
   [[ "$(cat "$marker")" == "$(sdp_test_marker_text)" ]] || { sdp_test_error 'marker does not match root, instance, port and OS account.'; return 1; }
   [[ -L /p4 && "$(readlink /p4)" == "$TEST_ROOT/p4" ]] || {
      sdp_test_error '/p4 must be the symlink owned by this disposable deployment.'; return 1;
   }
}
# Change User Description Committed
#1 34004 Russell C. Jackson (Rusty) Improve SDP backup/recovery, Maintenance, logging and cloud operation.

Add owned checkpoint locks, recovery-aware retention, preserved database switches,
bounded cleanup and coordinated AWS/Azure snapshots. Fix service-user password
initialization, edge staging, standby promotion state parsing, proxy cache setup,
typed depot verification and historical-server configuration/error handling.
Remove unused OTP programs; keep Windows removed, server.locks cleanup and the
journal-count condition unchanged. Add no global shell strict modes.

Update operational documentation and add reproducible mkdirs.sh/mkdirs.cfg
container assurance. Validate Ubuntu 26.04 and UBI 8.10/9.8/10.2 across both Python
runtimes: 44 stages; 428 offline tests per runtime/OS, zero offline skips;
19 deployed-archive comparisons per combination. Three six-node topology runs
pass all 30 recovery/failure scenarios. P4D 2023.1 through 2026.1 on UBI 8/9
pass all 14 cells and 98 scenarios. Static, documentation and provenance checks
pass. Containers do not certify every fleet kernel, patch build or integration.

Tested source manifest SHA-256:
e1a23e17b8ced8c1148d9a250589977c6f6e98606bf2a81dc3ff5d7c909e3695
Deployed comparison archive SHA-256:
1bd23217356ee3808e040d39aea5be9519bda7c8f2b4924656a70aff8ad7293a