The test kit opens whatever database TEST_DATABASE_URL names, the application's included #224
Open
opened 2026-10-16 01:52:38 +00:00 by cgalo5758
·
0 comments
Labels
Clear labels
accessibility
area/billing
area/catalog
area/discourse
area/domains
area/entitlements
area/fedwiki
area/identity
area/integrations
area/licensing
area/member-ui
area/meta
area/operator-ui
area/ops
area/testing
duplicate
good-first-issue
invalid
privacy
security
upstream
wontfix
A barrier for people using assistive technology or a keyboard alone.
The Stripe mirror, checkout, subscriptions, invoices, fulfillment.
Products, prices, plan ladders, purchasability.
The Discourse integration.
The domains registry, claims, placements, the certificate ask.
Entitlement sets, rules, grants, pools, provisioning.
The Federated Wiki integration and farm sync.
Sign-in, sessions, persons, organizations, workspaces, roles.
The provider registry, outbox and webhooks in general.
Licenses, the contributor agreement, SPDX headers.
Member pages.
The repository itself, its contributing guide, CI, the tracker and the workflow.
Operator pages, forms, lists, the design system.
Deployment, configuration, migrations, workflows, instance settings.
The test stack, screens, lint, walkthroughs.
Closed because another issue already covers it.
Small, self-contained, and explained enough to be a first contribution.
Closed because it is not a ticket for this repository.
Touches what a person's data reveals.
Touches authentication, authorization, secrets or data exposure.
Waits on another repository or project before it can move.
Closed because it will not be done, with the reason in the last comment.
kind
bug
The software does something other than what it promises; closed when it again does what it promises.
kind
debt
Code, tests or tooling to clean up with nothing visible changing; closed when they are cleaner.
kind
design
A question to settle before work can be defined; closed when the decision is written down.
kind
docs
Documentation that is wrong or missing; closed when it says the right thing.
kind
enhancement
Something the software does not do yet; closed when it does.
priority
critical
Blocks the active milestone or harms members now.
priority
high
Next in line inside the active milestone.
priority
low
Inside the active milestone, when nothing else is left.
priority
medium
Inside the active milestone, after the high ones.
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: wiki-cafe/member-console#224
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What a contributor runs into
Package tests reach the shared test databases through
internal/testkit/dbtest.Open(internal/testkit/dbtest/open.go:59) andCounted(internal/testkit/dbtest/counted.go:27) open the address inTEST_DATABASE_URL.DSN(open.go:46) hands that address to tests that connect on their own, andScratch(internal/testkit/dbtest/scratch.go:28) creates its scratch databases next to it.OpenE2E(open.go:74) opensE2E_DATABASE_URLfortest/e2e/plan-management. The only check,ledgerBehind(open.go:146), fails a database whose core migrations are behind. The application's own database is migrated too, so it passes.This has happened. A verification run was told to set
TEST_DATABASE_URLto the application database's address,MC_DB_DSNintest/.env. The package tests committed their organizations into it. The browser walkthroughs drive the running console on that same database, and one of them then failed on rows it had not made.test/reset-test-db.shalready refuses to reset the application database, but only by one name: it stops when the database is calledmember_console(test/reset-test-db.sh:77-80).CONTRIBUTING.md:36-37tells a contributor to "pointTEST_DATABASE_URLat a migrated Postgres", which any application database is.Why it costs
The tests commit rows and delete none, and some change rows every test shares or drop and recreate an index while they run (#192 lists them). Pointed at an application database, they write into data a person is using, and the damage shows up later and somewhere else, as it did in the walkthrough. Nothing stops the same mistake against any database the address can reach.
Finishing #192 does not cover this. A per-test transaction or a cloned database still starts from whatever database the address names.
Where
internal/testkit/dbtest/open.go:DSN,Open,OpenE2Eandopened.internal/testkit/dbtest/counted.goandinternal/testkit/dbtest/scratch.go, which take their address fromDSN.test/reset-test-db.sh:77-80.CONTRIBUTING.md:36-37.Done when
dbtestrefuses a database whose name does not end in_testor_e2e, the suffixes of the namestest/bootstrap-stack.shwrites (member_console_testandmember_console_e2e,test/bootstrap-stack.sh:355-356).Open,CountedandOpenE2Echeck the namecurrent_database()reports before the test runs anything.DSNchecks the name in the address and refuses an address that names no database. The refusal fails the test and names the variable and the database.test/reset-test-db.shapplies the same rule instead of refusing one name.CONTRIBUTING.mdsays the database's name must end that way.browsertest.AppDB(test/e2e/browsertest/session.go:31), which opens the running console's database on purpose for the walkthroughs, stays as it is.