Skip to content

test(e2e): embedded-postgres smoke leg and WithEmbeddedPostgres (RIG-2906) - #2211

Merged
mattwilkinsonn merged 3 commits into
mainfrom
compass-comms/rig-2906-embedded-postgres-smoke
Oct 12, 2026
Merged

mattwilkinsonn merged 3 commits into
mainfrom
compass-comms/rig-2906-embedded-postgres-smoke

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 3 PRs:

  1. main
  2. "test(e2e): embedded-postgres smoke leg and WithEmbeddedPostgres (RIG-2906)" (this PR)
  3. docs(testing): document the Go testing tiers (RIG-2908) #2221
  4. docs(ci): describe CI as the job set behind the rollup check (RIG-5280) #2222

What

T4 of docs/designs/infra/ci/compass-test-harness-tiers/design.md, built on plain NewFixture per the T3 errata (there is no WithOwnStack).

  • TestEmbeddedPostgresSmoke (go/e2e/embedded_postgres_test.go, podman tag) stands up its own stack over the stack-owned wrapper-process postgres, the product default. It asserts:
    • the stack.pgids record names a proc postgres group, and that group is alive;
    • health is Ready;
    • one authed GetServerInfo succeeds;
    • after an explicit Down: not Ready, the postgres group is reaped (kill(-pgid, 0) returns ESRCH), and the pgid record is removed.
  • WithEmbeddedPostgres() states that a leg needs the stack-owned postgres. Plain NewFixture already takes that arm, so the option sets nothing on stack.Config. It fails the test if an external DSN is also set (buildFixtureConfig).
  • Fixture.StateDir() exposes where the pgid record lives. assertNoStackPostgres now uses it instead of deriving the dir from the CA path.
  • Forge env fix: an own-stack NewFixture without WithForgeStub now blanks the forge, S3 and OTLP env for the test (scrubForgeEnv). The shared stack's configureForgeStub runs on a detached TB, so its Setenv lasts the whole process. A later own stack inherited the forge secret names, declared secrets its file lacked, and its server failed resolve master key. CI hit this when the new leg ran after the shared legs.
  • The record's Tasks list ticks T4.

Why

Every other e2e leg attaches to the suite postgres through ExternalDatabase. That path never touches the supervisor-owns-postgres lifecycle or the pgid-record teardown. This leg is the one dedicated e2e coverage of both.

Verification

  • go test -tags podman -run 'TestHarnessCore$|TestEmbeddedPostgresSmoke$|TestWithEmbeddedPostgresRejectsExternalDSN' ./e2e/: all PASS.
  • The CI failure order reproduced locally (TestClientModeHeadlessChain then TestEmbeddedPostgresSmoke): red before the env fix, green after.
  • Full go test -tags podman ./e2e/: ok, 63 PASS, 0 FAIL, 0 SKIP.
  • TestEmbeddedPostgresSmoke with -count=5: 5/5 PASS (the ESRCH check is deterministic, because the wrapper waits for the postmaster, which waits for its backends).
  • Mutations go red:
    • postgres removed from drainChildren: the group is alive after Down;
    • postgres child not recorded: no proc postgres entry;
    • conflict guard removed: TestWithEmbeddedPostgresRejectsExternalDSN/conflict fails.
  • golangci-lint, tagged set: 0 issues. go vet -tags podman ./e2e/ passes.
  • rumdl check on the record is clean. design-ledger-gate: OK.

Spec-impact: none
Ledger-impact: none (ticks T4 in the frozen record's Tasks list; no new decision)

Closes RIG-2906

Refs RIG-2742

Co-authored-by: Matt Wilkinson matt@rigel.build

…2906)

TestEmbeddedPostgresSmoke stands up its own stack over the stack-owned
postgres, the product default, and checks the pgid record names a live
postgres group, Ready health, one authed GetServerInfo, then a clean
Down: not Ready, the postgres group reaped, the record removed. Every
other leg attaches to the suite postgres, so this is the only e2e leg
that covers the supervisor-owns-postgres teardown.

WithEmbeddedPostgres pins that arm and fails the test when combined
with an external DSN. Fixture.StateDir exposes the record's location.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@trunk-io

trunk-io Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Review at head f86889b9: high 0, medium 0, low 0, nit 0

  • Scope: the whole PR, all lenses, 2 rounds. Checked: whether the option is inert under the T4 contract, whether the ESRCH check is deterministic (wrapper → postmaster → backends), the v2 pgid parse, repeated Down, ordering against the shared fixture and zz_legsix, and the record tick.
  • Round 1 found 3 low, all folded: a unit test for the conflict guard, a more accurate option doc, and assertNoStackPostgres now uses StateDir(). Round 2 found 1 low (the guard test doc claimed it needs no podman), folded.
  • Checks: TestHarnessCore, TestEmbeddedPostgresSmoke and TestWithEmbeddedPostgresRejectsExternalDSN all PASS. The smoke leg passes 5/5 with -count=5. Mutations go red: postgres not drained, postgres not recorded, guard removed. Tagged golangci-lint reports 0 issues. rumdl and design-ledger-gate are clean.

@linear-code

linear-code Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

RIG-2906

RIG-2742

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-comms-rig-2906-embed.compass-eng-docs.pages.dev

Deployed from compass-comms/rig-2906-embedded-postgres-smoke at 7bca1ad.

Changed pages:

rigel-mintaka and others added 2 commits October 11, 2026 20:42
…e stub (RIG-2906)

The shared stack sets the forge env for the whole test process. A later
own-stack NewFixture without WithForgeStub inherited those secret names,
so its server declared forge secrets the fixture's secrets file did not
hold and failed to boot. NewFixture now blanks that env for the test
when the forge stub is off.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Review at head 7bca1ad2: high 0, medium 0, low 0, nit 0

  • Scope: the whole PR, all lenses, 3 rounds. CI e2e was red at f86889b9: the shared stack leaks its forge env to the process, so an own stack without the forge stub failed resolve master key. Fixed in 9a9f6cce (scrubForgeEnv when the forge stub is off) and 7bca1ad2 (the CA and scope-grant names added to the list).
  • Round 3 checked t.Setenv legality (no t.Parallel; on the detached TB, restoreEnv undoes it), that blanking secret-provider, S3 and OTEL is safe (flags and spec env win), and the scrub-then-set order. Its 1 low is folded.
  • Checks: the CI failure order was reproduced locally, red before and green after. Full go test -tags podman ./e2e/ is ok with 63 PASS, 0 FAIL, 0 SKIP. Tagged golangci-lint reports 0 issues. Earlier mutations stay red.

@mattwilkinsonn
mattwilkinsonn merged commit f3fdf72 into main Oct 12, 2026
25 checks passed
@mattwilkinsonn
mattwilkinsonn deleted the compass-comms/rig-2906-embedded-postgres-smoke branch October 12, 2026 19:18
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.

2 participants