Skip to content

test(googlesql): build the Spanner harness once per test binary, in a temp dir - #437

Merged
rebelice merged 1 commit into
mainfrom
claude/sad-bohr-670b18
Sep 24, 2026
Merged

rebelice merged 1 commit into
mainfrom
claude/sad-bohr-670b18

Conversation

@rebelice

Copy link
Copy Markdown
Collaborator

Problem

TestAnalysisDifferential failed in CI (run 35838145547) with:

oracle_test.go:96: starting harness: fork/exec .../harness/googlesql-spanner/googlesql-spanner: text file busy

Eight googlesql oracle tests (analysis, and corpus/datatypes/ddl/expr/pivot_unpivot/select/spanner_ddl in parser) each ran go build -o harness/googlesql-spanner/googlesql-spanner . and exec'd that path. CI runs packages with go test -p=8, so the analysis and parser test binaries could build into the same file at once and one exec'd a binary the other was still writing.

Fix

  • New spannertest.HarnessBinary(t) builds the harness once per test binary (sync.Once) into a private os.MkdirTemp dir, so no two processes touch the same file. It skips when the harness project is absent and fails with the build output on error.
  • The eight per-file build blocks collapse to that one call; the per-file harness types and verdict plumbing are unchanged.
  • A TestMain in googlesql/parser and googlesql/analysis removes the temp dir at exit so the 49 MB binary does not accumulate across local runs.
  • The harness module is untouched.

Verification

  • go test ./googlesql/analysis/ ./googlesql/parser/ -count=1 -p=8 run six times against the auto-started emulator: all pass, no temp dir or module-dir binary left behind.
  • gofmt -l and go vet clean on touched files.

🤖 Generated with Claude Code

… temp dir

Every googlesql oracle test built harness/googlesql-spanner into the module
dir and exec'd it from there. CI runs packages with `go test -p=8`, so the
analysis and parser test binaries could build into the same path at once and
one exec'd a file the other was still writing:

    oracle_test.go:96: starting harness: fork/exec .../googlesql-spanner:
    text file busy

spannertest.HarnessBinary now builds the harness once per test binary
(sync.Once) into a private os.MkdirTemp dir, so no two processes touch the
same file. The eight per-file build blocks (analysis, corpus, datatypes, ddl,
expr, pivot_unpivot, select, spanner_ddl) collapse to one call. A TestMain in
each package removes the temp dir at exit; the harness module is untouched.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T02:39:31.633656Z 4b29cd7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@rebelice
rebelice merged commit 404f4d9 into main Sep 24, 2026
1 check 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