Skip to content

Report per-test durations from Go unit test shards - #20703

Merged
pelikhan merged 3 commits into
mainfrom
pelikhan/fix-postgresx-test-timeout
Nov 12, 2026
Merged

pelikhan merged 3 commits into
mainfrom
pelikhan/fix-postgresx-test-timeout

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

The "Go unit tests (storage, shard 1)" check times out at 10m in server/internal/postgresx (PR run 43257290598, and also on main in run 43253800690). The panic log named only the test that was running at the deadline, TestWorkflowValueCollectionSnapshotPermutationConvergence. It did not show which tests had used up the shard's time budget, which made the timeout hard to attribute.

Changes

  • .github/workflows/cgo.yml: the Go unit test step now runs go test with -v for both sharded and unsharded areas, so every shard log records how long each test took.
  • tests/unit/cao-go-ci-plan.test.mjs: the mocked go argument positions are updated for the extra flag.

Root cause and relationship to #20695

The timeout comes from per-test fixture provisioning: each test built about 360 daily partitions, costing about 5s. That is fixed by 81844a3 (template-database clones), which this branch is rebased onto and which is also in #20695. With that commit, the full internal/postgresx package takes 352s locally, about 90s per storage shard. Review this PR after #20695, or merge it alongside.

Notes for reviewers

  • I did not skip, loosen, or remove any tests, and I did not raise the timeout.
  • The slowest remaining tests (27-42s each) are TestAuditCurationSharedFixture, TestOversizedStatisticalInputIsCappedBeforePublication, TestWorkflowValueCollectionSnapshotPermutationConvergence, and TestPersistedStatisticalBundles. Their time goes to the production Publish call, about 0.7s each.
  • pg_stat_statements shows that Publish spends more time planning queries (11.4s) than executing them (8.9s) over a 42-publish run, because many statements touch every daily partition.
  • I tried running the permutation test's subtests in parallel. Even two concurrent publishes fail with out of shared memory under the default max_locks_per_transaction=64, so I reverted that attempt. This should be handled as a separate production Publish issue.

Validation

  • Full internal/postgresx run against PostgreSQL 16: 209 tests pass in 352s.
  • node --test tests/unit/cao-go-ci-plan.test.mjs tests/unit/workflow-contract-ci-triggers.test.mjs: 27/27 pass, run with bash 5. The CI step uses mapfile, which macOS's bundled bash 3.2 lacks.

pelikhan and others added 3 commits November 12, 2026 09:59
…edundant fixtures

Since the SQLite removal, every testutil.Postgres fixture provisions a full
canonical store (~360 daily partitions, ~5s), pushing internal/server past
the 10m go test timeout. Provision one template database per test process
through the production store and clone it per test (CREATE DATABASE ...
TEMPLATE), falling back to a private schema when the role cannot create
databases. Reclaim databases left by exited processes.

Also share one app across TestSessionArchiveResponseClosesReader subtests
and stop re-executing repository queries already covered by the full
dashboard corpus test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The storage shard timeout log showed only the test running at the 10m
deadline, not which tests consumed the budget. Run Go unit tests with -v so
every shard log records per-test durations and the next slow shard can be
attributed directly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review November 12, 2026 18:24
@pelikhan
pelikhan requested a review from mnkiefer as a code owner November 12, 2026 18:24
@pelikhan
pelikhan merged commit f85ff07 into main Nov 12, 2026
46 of 52 checks passed
@pelikhan
pelikhan deleted the pelikhan/fix-postgresx-test-timeout branch November 12, 2026 18:29
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