fix(auth): clean up stale test users before signup in integration tests#3441
fix(auth): clean up stale test users before signup in integration tests#3441PierreBrisorgueil merged 2 commits intomasterfrom
Conversation
Auth integration tests used hardcoded emails without cleaning the database before each run. On shared MongoDB instances (e.g. ARC self-hosted runners), stale data from previous CI runs caused cascading test failures. Add pre-signup cleanup in all beforeAll/beforeEach hooks across the four auth integration test files to purge any leftover users by email before attempting signup. Closes #3437
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 12 minutes and 39 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3441 +/- ##
=======================================
Coverage 85.51% 85.51%
=======================================
Files 113 113
Lines 2879 2879
Branches 795 795
=======================================
Hits 2462 2462
Misses 331 331
Partials 86 86 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes auth integration test flakiness on shared MongoDB runners by proactively removing stale users before signups that use hardcoded emails.
Changes:
- Added pre-signup cleanup (via
UserService.getBrut+UserService.remove) inbeforeAll/beforeEachhooks across auth integration test suites. - Introduced a
purgeUser(email)helper in the signup-organization integration tests and called it before creating users with fixed emails. - Applied the cleanup pattern to authorization and abilities integration tests to prevent cascading failures from prior CI runs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| modules/auth/tests/auth.integration.tests.js | Purges known hardcoded test users before registration/password reset/security/verification/lockout setup. |
| modules/auth/tests/auth.abilities.integration.tests.js | Purges abilities test users before creating them in beforeAll. |
| modules/auth/tests/auth.authorization.integration.tests.js | Purges authorization test users before creating them in beforeAll. |
| modules/auth/tests/auth.signup.organization.integration.tests.js | Adds purgeUser helper and uses it to remove stale org-signup users prior to signup requests. |
Summary
purgeUsercleanup in allbeforeAll/beforeEachhooks across the four auth integration test filesFiles changed
modules/auth/tests/auth.integration.tests.js— Registration, Password reset, Security, Email verification, Account lockout sectionsmodules/auth/tests/auth.abilities.integration.tests.js— beforeAll cleanupmodules/auth/tests/auth.authorization.integration.tests.js— beforeAll cleanupmodules/auth/tests/auth.signup.organization.integration.tests.js— per-test cleanup viapurgeUserhelper (also cleans org/membership data)Test plan
Closes #3437