Repository navigation
test(server): run the acceptance scenarios on Postgres as well as memory - #90
Merged
Merged
Conversation
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>
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 missedsecrets).internal/server: the harness takes its store fromnewTestStore: memory by default, Postgres whenDIFFERENTLY_TEST_POSTGRES_URLis set.harness.storeis now astore.Store; the tests only used interface methods.make test-postgresruns 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 usesDIFFERENTLY_TEST_POSTGRES_URLif set, else a disposable container as before.DIFFERENTLY_TEST_POSTGRES_REQUIREDset (the make target sets it), a missing database fails the run instead of skipping.make test-postgres, and is renamedpostgres conformance and acceptance.CHANGELOG.md, updated.How was it tested?
make test-postgrespasses; 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.DIFFERENTLY_TEST_POSTGRES_REQUIREDwithout a DSN fails both packages.make fmt-check vet testpasses on the default (memory) store;npm run buildinsite/passes.Checklist
make verifypasses (make fmt-check vet testandmake test-postgresrun here; SDKs and Helm untouched)git commit -s)api/openapi.yaml, both SDKs anddocs/feature-parity.md(no API change)🤖 Generated with Claude Code