fix: improve BookingReferenceRepository integration test isolation#26707
Merged
keithwillcode merged 1 commit intomainfrom Jan 11, 2026
Merged
Conversation
The integration tests were flaky because they relied on a shared booking created in beforeAll, which could cause race conditions when tests run in parallel or when cleanup from previous runs interfered. Changes: - Use seed user (member0-acme@example.com) when available, fallback to creating a test user for local development - Create a fresh booking in beforeEach instead of sharing one across tests - Track created bookings and clean them up properly in afterEach - Fix import organization to satisfy linter Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
anikdhabal
approved these changes
Jan 11, 2026
Anshumancanrock
pushed a commit
to Anshumancanrock/cal.com
that referenced
this pull request
Jan 12, 2026
…alcom#26707) The integration tests were flaky because they relied on a shared booking created in beforeAll, which could cause race conditions when tests run in parallel or when cleanup from previous runs interfered. Changes: - Use seed user (member0-acme@example.com) when available, fallback to creating a test user for local development - Create a fresh booking in beforeEach instead of sharing one across tests - Track created bookings and clean them up properly in afterEach - Fix import organization to satisfy linter Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes flaky integration tests in
BookingReferenceRepository.integration-test.tsthat were introduced by commit eecf9e1. The tests were failing withForeignKeyConstraintViolationerrors (Prisma error P2003) on theBookingReference_bookingId_fkeyconstraint.Root cause: The tests created a single booking in
beforeAllthat was shared across all tests. This caused race conditions when tests run in parallel - one test's cleanup could delete the booking while another test was still trying to use it.Fix:
member0-acme@example.com) when available in CI, with fallback to creating a test user for local developmentbeforeAlltobeforeEachso each test gets a fresh, isolated bookingafterEachMandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist
Requested by: @keithwillcode
Link to Devin run: https://app.devin.ai/sessions/a4fb71e0632041b28f8ed19205b96cf9