Skip to content

redshift/parser: retry first-set oracle container startup on slow CI runners - #405

Merged
rebelice merged 1 commit into
mainfrom
claude/priceless-khorana-25c23e
Aug 28, 2026
Merged

redshift/parser: retry first-set oracle container startup on slow CI runners#405
rebelice merged 1 commit into
mainfrom
claude/priceless-khorana-25c23e

Conversation

@rebelice

Copy link
Copy Markdown
Collaborator

Problem

The redshift-container-tests CI job intermittently fails (3 times in the last day on #403 alone) with the same signature across all four first-set oracle tests (TestSimpleTypenameLeadTokensMatchPG, TestTypenameLeadTokensMatchPG, TestAExprLeadTokensMatchPG, TestFuncTypeLeadTokensMatchPG):

first-set oracle unavailable in CI: container start: run postgres: generic container: create container: context deadline exceeded

Root cause: startFirstSetOracle gave container creation only 15 seconds. On a busy GitHub runner the postgres:17-alpine image pull alone can exceed that. The sibling harnesses in this repo (redshift/parser/paren_oracle_test.go, redshift/catalog/container_helper_test.go) were already bumped to 120s with the "Generous timeout" comment — this helper was left behind.

Fix

  • Extract one full bootstrap attempt (create → connection string → open → ping) into startFirstSetOracleAttempt() with the repo-standard 120s per-attempt timeout. On failure it tears down every partially-created resource — including the container tcpg.Run can return alongside its error (TerminateContainer is nil-safe) — so retries don't accumulate leaked containers on the runner.
  • Retry up to 3 attempts inside the sync.Once body, 2s apart, with a t.Logf per failed attempt so CI logs show retries happening. The docker preflight stays outside the loop: a missing daemon is deterministic, and this keeps the local skip path fast.
  • Fail-in-CI / skip-locally policy unchanged. After 3 failures the errors.Join'd attempt errors flow into the existing t.Fatalf("first-set oracle unavailable in CI: ...") — the tests still fail loudly (never skip) when the oracle is genuinely unavailable, preserving the FIRST-set drift guardrail.

Worst case in CI is 3×120s plus pauses (~6 min), well inside the job's 30-minute limit.

Verification

go test ./redshift/parser -run 'LeadTokensMatchPG' -count=1 -v

against local Docker: all four tests pass (shared container starts once, ~6.4s total). go vet ./redshift/parser clean.

🤖 Generated with Claude Code

…runners

The redshift-container-tests job intermittently failed (3 times in one
day on PR #403) with "first-set oracle unavailable in CI: container
start: ... create container: context deadline exceeded" across all four
LeadTokensMatchPG tests. Root cause: startFirstSetOracle gave container
creation only 15 seconds, which a busy GitHub runner can exceed on the
postgres:17-alpine image pull alone. The sibling harnesses
(paren_oracle_test.go, redshift/catalog/container_helper_test.go) were
already bumped to 120s; this helper was left behind.

- Extract one bootstrap attempt (create, conn string, open, ping) into
  startFirstSetOracleAttempt with the repo-standard 120s per-attempt
  timeout; on failure it tears down every partially-created resource,
  including the container tcpg.Run can return alongside its error, so
  retries don't leak containers on the runner.
- Retry the attempt 3 times inside the sync.Once body, 2s apart, with a
  t.Logf per failed attempt so CI logs show the retries. The docker
  preflight stays outside the loop (deterministic failure, keeps the
  local skip path fast).
- Keep the fail-in-CI / skip-locally policy: after 3 failures the
  errors.Join'd attempt errors flow into the existing t.Fatalf, so the
  tests still fail loudly rather than skip when the oracle is genuinely
  unavailable.

Verified with `go test ./redshift/parser -run 'LeadTokensMatchPG'
-count=1` against local Docker: all four tests pass. Worst case in CI is
3x120s plus pauses, well inside the job's 30-minute limit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rebelice
rebelice merged commit 19c31a4 into main Aug 28, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant