Skip to content

test(server): run the acceptance scenarios on Postgres as well as memory - #90

Merged
reachjalil merged 1 commit into
pre-releasefrom
test/server-acceptance-on-postgres
Nov 11, 2026
Merged

reachjalil merged 1 commit into
pre-releasefrom
test/server-acceptance-on-postgres

Conversation

@reachjalil

Copy link
Copy Markdown
Member

What is this about?

The server acceptance scenarios run on Postgres as well as the memory store, locally and on every pull request.

What problem does it solve?

The scenarios in internal/server (tenancy, quotas, placement, reconcile, lifecycle, secrets, the scheduler races) ran only on the in-memory store, which production does not use. Postgres was covered only by the nine cases of the store conformance suite, and that suite passes by skipping when it has no database.

How is it implemented?

  • internal/store/postgres/postgrestest: Open(t, dsn) returns a migrated store in a new, empty schema and drops it when the test ends. The conformance suite uses it too, instead of dropping tables between subtests (the old list missed secrets).
  • internal/server: the harness takes its store from newTestStore: memory by default, Postgres when DIFFERENTLY_TEST_POSTGRES_URL is set. harness.store is now a store.Store; the tests only used interface methods.
  • make test-postgres runs the conformance suite and the server suite against Postgres with -race, one package after the other (-p 1): scheduler leadership is a single advisory lock per database. It uses DIFFERENTLY_TEST_POSTGRES_URL if set, else a disposable container as before.
  • With DIFFERENTLY_TEST_POSTGRES_REQUIRED set (the make target sets it), a missing database fails the run instead of skipping.
  • CI: the job that already starts Postgres 17 calls make test-postgres, and is renamed postgres conformance and acceptance.
  • Docs that state how these are tested, and CHANGELOG.md, updated.

How was it tested?

  • Against a local Postgres 18: make test-postgres passes; the two packages pass three times in a row with -race. Postgres committed about 7,700 transactions during one server run, and no test schema was left behind.
  • A wrong DSN fails the tests (it does not fall back to memory), and DIFFERENTLY_TEST_POSTGRES_REQUIRED without a DSN fails both packages.
  • make fmt-check vet test passes on the default (memory) store; npm run build in site/ passes.
  • Result: no defect found. Every scenario that passes on the memory store passes on Postgres unchanged.
  • Not run locally: the job on Postgres 17 (this PR's CI run does that), and the experimental-adapter build against Postgres.

Checklist

  • make verify passes (make fmt-check vet test and make test-postgres run here; SDKs and Helm untouched)
  • Commits are signed off (git commit -s)
  • API changes are reflected in api/openapi.yaml, both SDKs and docs/feature-parity.md (no API change)
  • User-visible behaviour is documented

🤖 Generated with Claude Code

The acceptance scenarios in internal/server ran only on the in-memory store,
which production does not use. Postgres was covered by the nine cases of the
store conformance suite.

The server test harness now takes its store from one place: the memory store
by default, and an empty Postgres schema when DIFFERENTLY_TEST_POSTGRES_URL
is set. The new postgrestest package creates that schema, migrates it and
drops it when the test ends; the conformance suite uses it too, instead of
dropping tables between subtests (it missed the secrets table).

`make test-postgres` runs both packages against Postgres, one after the other
because scheduler leadership is one advisory lock per database, and the CI
job that already starts Postgres calls it. With
DIFFERENTLY_TEST_POSTGRES_REQUIRED set, a missing database fails the run
instead of skipping it.

The whole server suite passes on Postgres (three runs in a row, with -race).
It exposed no defect.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Jalil <reachjalil@gmail.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI passed at 4b3784c.

@reachjalil
reachjalil merged commit 925ca71 into pre-release Nov 11, 2026
19 checks passed
@reachjalil
reachjalil deleted the test/server-acceptance-on-postgres branch November 11, 2026 01:25
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