The forum mapping tests pass only when another package has run first #33

Closed
opened 2026-09-21 07:18:11 +00:00 by cgalo5758 · 3 comments
Owner

What a contributor runs into

The Discourse integration's operator mapping tests pass in a full run and fail on their own. The mapping form lists entitlements from the resource keys whose provider column names Discourse, and nothing in that package sets the column: the integration's migration inserts the key with it null and leaves the stamp to boot-time provider registration. In a full run, another package registers the providers earlier and commits the stamp to the shared test database. Run alone against a database that has not seen it, the form offers no entitlement to choose and every create is refused.

Why it costs

A test that depends on another package's committed side effect hides its own precondition, and the failure it produces points at the form rather than at the missing stamp. Running one package in isolation, the usual move when narrowing a failure, is what breaks it.

Where

The Discourse integration's web package tests and the fixture they share.

Done when

The fixture stamps the provider itself, or registers the integration's manifest the way boot does, and the package passes on its own against a database that has run only its own migrations.

Migrated from status/issues.md at b7a0e15

## What a contributor runs into The Discourse integration's operator mapping tests pass in a full run and fail on their own. The mapping form lists entitlements from the resource keys whose provider column names Discourse, and nothing in that package sets the column: the integration's migration inserts the key with it null and leaves the stamp to boot-time provider registration. In a full run, another package registers the providers earlier and commits the stamp to the shared test database. Run alone against a database that has not seen it, the form offers no entitlement to choose and every create is refused. ## Why it costs A test that depends on another package's committed side effect hides its own precondition, and the failure it produces points at the form rather than at the missing stamp. Running one package in isolation, the usual move when narrowing a failure, is what breaks it. ## Where The Discourse integration's web package tests and the fixture they share. ## Done when The fixture stamps the provider itself, or registers the integration's manifest the way boot does, and the package passes on its own against a database that has run only its own migrations. Migrated from status/issues.md at b7a0e15
cgalo5758 added the
kind
debt
area/discoursearea/testing
labels 2026-09-21 07:18:11 +00:00
Author
Owner

This is one case of tests sharing one database: packages commit rows others read, so make test runs them one at a time (-p 1). #192 asks for each test to run in its own transaction or a cloned database, which would make this missing stamp fail in every run rather than only when the package runs alone.

This is one case of tests sharing one database: packages commit rows others read, so `make test` runs them one at a time (`-p 1`). #192 asks for each test to run in its own transaction or a cloned database, which would make this missing stamp fail in every run rather than only when the package runs alone.
Author
Owner

The FedWiki package has the same dependency on another package's committed rows. Run alone against a freshly reset test database, its three TestReconcileDomains* tests fail on placements_provider_fkey: a domain placement names its provider, and the core.providers row it points at is written by provider registration, which the tests of internal/integration run. In a full run that package runs first, so the row is already there.

The FedWiki package has the same dependency on another package's committed rows. Run alone against a freshly reset test database, its three `TestReconcileDomains*` tests fail on `placements_provider_fkey`: a domain placement names its provider, and the `core.providers` row it points at is written by provider registration, which the tests of `internal/integration` run. In a full run that package runs first, so the row is already there.
Author
Owner

Fixed in 063b4765 (Discourse) and f8f9551d (FedWiki). Each fixture now registers its integration's provider the way boot does, through the test kit's world.Providers, instead of relying on another package having registered it earlier in the run.

These eight tests failed when run alone on a freshly reset test database, and now pass:

  • internal/integrations/discourse/web: TestOperatorCreateMappingValid, TestOperatorCreateMappingUnknownGroup, TestOperatorCreateMappingAutomaticGroup, TestOperatorCreateMappingDuplicate and TestOperatorDeleteMapping. Registering Discourse stamps discourse_posting with its provider, so the mapping form offers it.
  • internal/integrations/fedwiki: TestReconcileDomainsAdoptsNamesPolicyWouldRefuse, TestReconcileDomainsReleasesOrphanedPlacements and TestReconcileDomainsClassifiesEveryBranch. Registering FedWiki writes the core.providers row a domain placement points at.

The fourth reconcile-domains test, TestReconcileDomainsKeepsARunningCreatesName, registers FedWiki itself and already passed alone.

Fixed in 063b4765 (Discourse) and f8f9551d (FedWiki). Each fixture now registers its integration's provider the way boot does, through the test kit's `world.Providers`, instead of relying on another package having registered it earlier in the run. These eight tests failed when run alone on a freshly reset test database, and now pass: - `internal/integrations/discourse/web`: `TestOperatorCreateMappingValid`, `TestOperatorCreateMappingUnknownGroup`, `TestOperatorCreateMappingAutomaticGroup`, `TestOperatorCreateMappingDuplicate` and `TestOperatorDeleteMapping`. Registering Discourse stamps `discourse_posting` with its provider, so the mapping form offers it. - `internal/integrations/fedwiki`: `TestReconcileDomainsAdoptsNamesPolicyWouldRefuse`, `TestReconcileDomainsReleasesOrphanedPlacements` and `TestReconcileDomainsClassifiesEveryBranch`. Registering FedWiki writes the `core.providers` row a domain placement points at. The fourth reconcile-domains test, `TestReconcileDomainsKeepsARunningCreatesName`, registers FedWiki itself and already passed alone.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wiki-cafe/member-console#33