fix: flake check
runner nix smoke / nix label and flake smoke (push) Canceled after 0s

This commit is contained in:
2026-10-06 21:58:50 +00:00
parent 69ee136349
commit fbb43b1db9
5 changed files with 21 additions and 19 deletions
+3 -2
View File
@@ -919,7 +919,7 @@ subcommand_normalize_backup() {
NORMALIZE_DATABASE="${PG_DATABASE:-testdb}"
NORMALIZE_ADMIN_ROLE="postgres"
NORMALIZE_PORT="${PG_PORT:-5432}"
NORMALIZE_PRELOAD_LIBRARIES="${PG_SHARED_PRELOAD_LIBRARIES:-pg_cron}"
NORMALIZE_PRELOAD_LIBRARIES="${PG_SHARED_PRELOAD_LIBRARIES-pg_cron}"
NORMALIZE_DATABASE_EXPLICIT=0
while [ $# -gt 0 ]; do
@@ -1060,7 +1060,8 @@ EOF
log notice "starting temporary local cluster"
with_closed_fds pg_ctl -D "$NORMALIZE_PGDATA" -o "-F" -w start > "$NORMALIZE_LOG" 2>&1 || {
log error "normalize-backup: failed to start temporary cluster; see $NORMALIZE_LOG"
cat "$NORMALIZE_LOG" >&2
log error "normalize-backup: failed to start temporary cluster"
exit 1
}
@@ -8,6 +8,7 @@ trap 'PG_WORKING_DIR=$restore_root postgres-cleanup >/dev/null 2>&1 || true; pg_
export LOCAL_DIR="$tmp_root/local"
export PG_DATABASE=postgres
export PG_SHARED_PRELOAD_LIBRARIES=''
mkdir -p "$LOCAL_DIR"
log notice "test case: normalize-backup rejects output inside input backup"
@@ -5,7 +5,7 @@ HECTIC_NAMESPACE=test-db-tool-postgres-init-busy-socket
PG_WORKING_DIR=$(mktemp -d)
export PG_WORKING_DIR PG_DATABASE=testdb PG_PORT=5432 PG_SHARED_PRELOAD_LIBRARIES=''
trap 'pg_harness_stop; rm -rf "$PG_WORKING_DIR"' EXIT INT TERM
trap 'postgres-cleanup >/dev/null 2>&1 || true; pg_harness_stop; rm -rf "$PG_WORKING_DIR"' EXIT INT TERM
log notice "setup: creating initial postgres cluster"
if ! postgres-init; then
@@ -26,17 +26,18 @@ done
[ -S "$PG_HARNESS_BUSY_SOCKET_PATH" ] || { log error "busy socket not ready"; exit 1; }
printf '%d\n' "$PG_HARNESS_BUSY_SOCKET_PID" > "${PG_HARNESS_BUSY_SOCKET_PATH}.lock"
log notice "test case: postgres-init fails when socket is pre-occupied"
log notice "test case: postgres-init reinitializes when socket is pre-occupied"
PG_REUSE=1
export PG_REUSE
set +e
postgres-init
code=$?
set -e
if [ "$code" = 0 ]; then
log error "test failed: postgres-init exited 0 with busy socket"
if ! postgres-init; then
log error "test failed: postgres-init did not recover from busy socket"
exit 1
fi
log notice "test passed: exited $code"
if ! pg_isready -h "$PG_WORKING_DIR/sock" -p 5432 >/dev/null 2>&1; then
log error "test failed: PostgreSQL unavailable after busy-socket recovery"
exit 1
fi
log notice "test passed"
+2 -2
View File
@@ -31,8 +31,8 @@
linuxDevShellStandalone = self.packages.${system}.linux-devshell-standalone;
archBootstrap = pkgs.fetchurl {
url = "https://geo.mirror.pkgbuild.com/iso/latest/archlinux-bootstrap-x86_64.tar.zst";
hash = "sha256-1YnwGo2li1yIzm6W6yYYwuZeY16Ddsrz1LRTY6/A3Ww=";
url = "https://archive.archlinux.org/iso/2026.10.01/archlinux-bootstrap-2026.10.01-x86_64.tar.zst";
hash = "sha256-DJyXt6WKigI8ngf4TLMHqegAbmXY/EwXuD3cgBC0XBA=";
};
ubuntuBootstrap = pkgs.fetchurl {
@@ -50,7 +50,6 @@ def shell_budgets(label):
source = f'. "$DECIDE_SH"; . "$CONTROLLER_SH"; . "$HCLOUD_SH"; '
ttl = int(dash(source + f'gcr_label_ttl "{label}"'))
profile = dash(source + f'gcr_label_profile "{label}"')
grace = int(dash(source + 'gcr_ttl_grace_sec')) // 60
script = source + f'gcr_bootstrap_script "{label}" token {ttl} runner'
rendered = dash(script)
match = re.search(r"runner:\n(?: .*\n)* timeout: (\d+)m\n", rendered)
@@ -62,7 +61,7 @@ def shell_budgets(label):
"gross-nix-x86 gross-nix-arm gross-nix-mixed-econ"
others = dash(source + f"for l in {labels}; do "
"printf '%s=%s\\n' \"$l\" \"$(gcr_label_ttl \"$l\")\"; done")
return ttl, profile, grace, int(match.group(1)), others.splitlines()
return ttl, profile, int(match.group(1)), others.splitlines()
budget = workflow_budget(os.environ["WORKFLOW_FILE"])
@@ -72,17 +71,17 @@ need(budget["runner_input"]["options"] == ["nix", "gross-nix-x86-perf", "gross-n
need(budget["build"] > 0 and budget["drain"] > 0 and budget["upload"] > 0, "non-positive timeout")
need(budget["build"] + budget["drain"] + 15 <= budget["workflow"], "workflow too short for build+drain")
ttl, profile, grace, runner_timeout, other_ttls = shell_budgets("gross-nix-x86-perf")
ttl, profile, runner_timeout, other_ttls = shell_budgets("gross-nix-x86-perf")
need(ttl == 480, f"expected 480m ttl, got {ttl}")
need(profile.split()[1] == "480", f"profile ttl drifted: {profile}")
need(all(line.endswith("=180") for line in other_ttls), f"default ttl drift: {other_ttls}")
need(budget["workflow"] < runner_timeout, "workflow must be below runner timeout")
need(minutes(os.environ["GITEA_WATCHDOG"]) >= budget["workflow"], "Gitea watchdog too short")
need(ttl + grace >= budget["workflow"] + 15, "VM ttl lacks bootstrap allowance")
need(ttl >= budget["workflow"] + 15, "VM ttl lacks bootstrap allowance")
highmem_ttl, highmem_profile, _, highmem_runner_timeout, _ = shell_budgets("gross-nix-x86-highmem")
highmem_ttl, highmem_profile, highmem_runner_timeout, _ = shell_budgets("gross-nix-x86-highmem")
need(highmem_ttl == 480, f"expected highmem 480m ttl, got {highmem_ttl}")
need(highmem_profile == "ccx53 480 0.8550", f"highmem profile drifted: {highmem_profile}")
need(highmem_runner_timeout == 480, f"highmem runner timeout drifted: {highmem_runner_timeout}")
print(f"PASS build={budget['build']}m drain={budget['drain']}m upload={budget['upload']}m workflow={budget['workflow']}m runner={runner_timeout}m ttl={ttl}m grace={grace}m watchdog={os.environ['GITEA_WATCHDOG']}")
print(f"PASS build={budget['build']}m drain={budget['drain']}m upload={budget['upload']}m workflow={budget['workflow']}m runner={runner_timeout}m ttl={ttl}m watchdog={os.environ['GITEA_WATCHDOG']}")