test(resources): consolidate 3 promoted QA tests into one shared-instance suite#1884
test(resources): consolidate 3 promoted QA tests into one shared-instance suite#1884kriszyp wants to merge 1 commit into
Conversation
relationship-parent-delete-cascade, relationship-transaction-atomicity, and resource-status-contract each booted their own vanilla-default Harper instance. Their fixtures are schema-compatible (identical Order/OrderItem schema in the two relationship tests, a disjoint Kv table in the status- contract test, no route/table name collisions), so merge them into one relationship-and-status-contract suite that boots a single shared instance, grouped by originating QA-id with a consolidated fixture (schema.graphql + resources.js). Cuts the integration-test boot count for this scenario group from 3 to 1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request consolidates three separate integration test suites (QA-196, QA-162, and QA-195) into a single, shared-instance test suite to optimize execution time by reducing redundant database boots. It merges their schemas, configurations, and custom resource handlers while deleting the obsolete individual test directories. The feedback suggests replacing fixed sleeps with converging polls when verifying background operations in the integration tests to prevent race conditions and flakiness.
| const delResult = await restDelete(`/Order/${orderId}`); | ||
| console.log(`\n[QA-196 P1 engine=${ENGINE}] DELETE /Order/${orderId} → status=${delResult.status}`); | ||
|
|
||
| await sleep(400); |
There was a problem hiding this comment.
When verifying background operations (such as index backfills or database reindexing) in integration tests, wrap the verification checks in a converging poll (retrying until the expected state is reached) instead of using fixed sleeps (e.g., sleep(400)) to prevent race conditions and test flakiness. This pattern is also used on lines 289, 361, 419, 463, 480, 579, 679, and 745.
References
- When verifying background operations (such as index backfills or database reindexing) after a service restart in integration tests, wrap the verification checks in a converging poll (retrying until the expected state is reached) to prevent race conditions and test flakiness.
|
Reviewed; no blockers found. |
What
Merges three promoted
resources/regression anchors that each booted their own Harper instance into a single suite that boots one shared instance:relationship-parent-delete-cascade.test.ts(QA-196)relationship-transaction-atomicity.test.ts(QA-162)resource-status-contract.test.ts(QA-195)→
relationship-and-status-contract.test.ts— one outersuite()with a singlebefore/after, three nested suites (one per QA-id) preserving every originaltest()verbatim, over a merged fixture. 3 Harper boots → 1.All three used vanilla-default config and their schemas were disjoint/identical, so no namespacing was required.
Why
Each promoted test file pays a full Harper process boot — the dominant integration-test cost. Tests within a file share one instance, so co-locating compatible anchors removes redundant boots without losing coverage. This is the first, exemplar application of the instance-affinity policy just added to the qa-explorer promotion pipeline; it also creates a host suite future promotions can append into rather than minting new files.
Verification
npm run test:integration -- integrationTests/resources/relationship-and-status-contract.test.ts:Same assertions and documented findings as the originals (QA-195's 5 documented status-contract findings are unchanged pre-existing behavior, not new failures). oxlint + prettier clean on the new files.
Scope
First of a possible series. The larger
database/groups (~9-scenario merge) are held pending a review of merged-file size vs. benefit;harper-procluster tests net zero and are intentionally excluded.— KrAIs (Claude Opus 4.8)
🤖 Generated with Claude Code