fix(just): run the integration suites as the superuser role #496
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/test-integration-createdb-role"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
just test-integrationandjust verify-democurrently fail at test setup against any dev stack whose database roles have been provisioned:Cause
#[sqlx::test]creates a database per test. The composeserverservice exports a DATABASE_URL that connects asmokosh_migrator, and PMS-489 provisions that role withLOGIN BYPASSRLSand deliberately withoutCREATEDB(src/db/provision.rs). So the role the recipes use cannot do the one thing the test harness requires.CI never surfaced this because
.forgejo/workflows/integration.ymlpoints DATABASE_URL at the postgres superuser. The recipes carry a comment claiming they mirror that workflow one-to-one, and they had quietly stopped doing so: the comment even asserted that "theserverdev service already exports a usable DATABASE_URL", which is what makes the failure read as a broken local environment rather than a recipe bug.The failure is invisible on a fresh clone and appears only once the roles exist, which is why it survived:
just devprovisions them on first boot, so the recipes work right up until the stack has been started once.Fix
Both recipes override DATABASE_URL to
MOKOSH_ADMIN_DATABASE_URLfor the duration of the run, which restores the true one-to-one mirror of integration.yml. The override is expanded inside the container, so the credential stays in the compose environment and never reaches the host shell or a process listing.The stale comment is replaced with a note explaining the override and naming the error, so the next person to hit
42501finds the reason next to the code that causes it.Alternative rejected
Granting
CREATEDBtomokosh_migratorinprovision.rswould also make the suites pass, but that role holds the same privileges in staging and production as it does locally. Widening a production role to suit a local test runner is the wrong trade, and it would erode the PMS-489 split that keeps the migrator role narrow on purpose.Verification
just verify-demo: green (seed_demo8/8, plusdata_transfer).just test-integration: green end to end, 713 passed, 0 failed, 71 test binaries, recipe exit 0.42501before the change, and28P01before that when the roles did not yet exist at all.