Repository navigation
fix(test): pin 000086 migration test to version 86, not HEAD - #1436
Conversation
TestMigration_RemoveApproveOwnFromStandardUsers failed on PR #808 (000087 marketplace) and PR #1428 (000088 view:config) because: - Sub-test 1 called RunMigrations (to HEAD) instead of pinning to 86; later migrations could alter the same group's permissions. - Sub-test 2 (down migration) called RunMigrations then RollbackMigrations(1), which rolls back the LATEST migration rather than 000086.down. On a branch where HEAD=087, the rollback runs 087.down (marketplace), leaving approve-own absent and failing the assertion. Fix: replace both RunMigrations calls with MigrateToVersion(86) so the test is isolated to exactly the migration it covers, regardless of how many migrations land on downstream branches. This is the same pattern already used correctly in 000088_grant_view_config_to_nonadmin_groups_test.go. Verified: go test -tags=integration -count=3 passes on the fix branch (latest=086), a worktree simulating HEAD=087, and a worktree simulating HEAD=088. Closes the cross-migration interaction blocking #808 and #1428 CI.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe migration integration test now pins PostgreSQL to version 000086 before checking removal and restoration of ChangesMigration test determinism
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
TestMigration_RemoveApproveOwnFromStandardUsers(added by PR #1422) was failing on the Integration Tests job of PR #808 (fix/292-wave4, migration 000087) and PR #1428 (fix/qa-nonadmin-settings-rbac, migration 000088).Root cause: real cross-migration interaction, not a flake.
The test has two sub-tests:
"approve-own removed, sibling own-verbs retained" - migrated from 83 to HEAD, then asserted specific permissions. Passes on both branches (087 and 088 don't touch
purchasespermissions), but is fragile."down migration restores approve-own" - called
RunMigrations(migrates to HEAD), thenRollbackMigrations(1). On a branch where HEAD=087, this rolls back 087.down (marketplace) -- not 000086.down -- leaving approve-own absent and failing the assertion. Same on HEAD=088. Deterministic failure on both branches.Fix: Replace both
RunMigrationscalls withMigrateToVersion(ctx, pool, migrationsPath, 86)so each sub-test is pinned to exactly the migration it covers. This is the same pattern already used correctly in000088_grant_view_config_to_nonadmin_groups_test.go(which pins to 86 before testing 088).Verification
fix/migration-test-pin-version(main)fix/292-wave4(#808)fix/qa-nonadmin-settings-rbac(#1428)Static gates:
go build ./...clean,go vetclean,golangci-lintno issues,gocyclo -over 10exit 0.Test plan
Summary by CodeRabbit
approve-own:purchasespermission while preserving related permissions.