Skip to content

meta(mssql): fix flaky test - #17986

Closed
WikiRik wants to merge 1 commit into
mainfrom
WikiRik/flaky-mssql-test
Closed

WikiRik wants to merge 1 commit into
mainfrom
WikiRik/flaky-mssql-test

Conversation

@WikiRik

@WikiRik WikiRik commented Oct 4, 2025 •

Copy link
Copy Markdown
Member

Pull Request Checklist

  • Have you added new tests to prevent regressions?
  • If a documentation update is necessary, have you opened a PR to the documentation repository?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description of Changes

This should fix the flakyness this test has because we're retreiving by id DESC

Summary by CodeRabbit

  • Tests
    • Updated MSSQL regression test to run login log creation steps sequentially rather than in parallel.
    • Adjusted test control flow to ensure each user’s login log is created one after another.
    • Maintains existing queries and assertions with no changes to test expectations.
    • No impact on runtime features; this change only affects test execution behavior.

@WikiRik
WikiRik requested a review from a team as a code owner October 4, 2025 16:15
@WikiRik
WikiRik requested review from ephys and sdepold October 4, 2025 16:15
@coderabbitai

coderabbitai Bot commented Oct 4, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The MSSQL regression test changes the creation of login logs from parallel execution using Promise.all to sequential execution using individual awaits. All subsequent queries and assertions remain unchanged. No exports or public interfaces were modified.

Changes

Cohort / File(s) Summary of Changes
MSSQL regression test flow
packages/core/test/integration/dialects/mssql/regressions.test.js
Replaced Promise.all-based parallel createLoginLog calls with sequential awaits, altering control flow from concurrent to serial. No other logic alterations.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Tester as Test Runner
  participant MSSQL as MSSQL Test Helpers

  rect rgba(200,230,255,0.3)
  note over Tester,MSSQL: Previous (Parallel)
  Tester->>MSSQL: createLoginLog(userA)
  Tester->>MSSQL: createLoginLog(userB)
  Tester->>MSSQL: createLoginLog(userC)
  par Parallel executions
    MSSQL-->>Tester: A created
    MSSQL-->>Tester: B created
    MSSQL-->>Tester: C created
  end
  end

  rect rgba(220,255,220,0.3)
  note over Tester,MSSQL: New (Sequential)
  Tester->>MSSQL: createLoginLog(userA)
  MSSQL-->>Tester: A created
  Tester->>MSSQL: createLoginLog(userB)
  MSSQL-->>Tester: B created
  Tester->>MSSQL: createLoginLog(userC)
  MSSQL-->>Tester: C created
  end

  Tester->>MSSQL: Run queries and assertions (unchanged)
  MSSQL-->>Tester: Results
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • sdepold
  • ephys

Poem

I thump my paw: one hop, then two—
No racing hares, just steady through.
Logs in a row, like seeds I sow,
Await by await, watch footprints grow.
Burrow is calm, the tests all chime—
Sequential steps, on rabbit time. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly indicates that the pull request addresses a flaky test in the MSSQL dialect, which aligns with the changes that serialize the login log creation to prevent intermittent failures in that integration test.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch WikiRik/flaky-mssql-test

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a3c155 and 9d95aca.

📒 Files selected for processing (1)
  • packages/core/test/integration/dialects/mssql/regressions.test.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
packages/**/test/**/*.test.js

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Name integration tests with the .test.js suffix

Files:

  • packages/core/test/integration/dialects/mssql/regressions.test.js
packages/**/test/**/*.test.{js,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

packages/**/test/**/*.test.{js,ts}: Use Support.getTestDialectTeaser() for dialect-specific test descriptions
Use beforeEach/afterEach to sync with { force: true } and close Sequelize instances in tests
In tests, skip unsupported behavior with dialect.supports.featureName checks

Files:

  • packages/core/test/integration/dialects/mssql/regressions.test.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Upload install and build artifact (Node 18)
  • GitHub Check: Upload install and build artifact (Node 20)
🔇 Additional comments (1)
packages/core/test/integration/dialects/mssql/regressions.test.js (1)

59-62: LGTM! Sequential creation fixes the race condition.

Replacing parallel creation with sequential awaits ensures deterministic ID assignment, which is critical for the test at line 96 that orders results by id DESC. With parallel execution, the insertion order (and thus ID values) was non-deterministic, causing flaky test failures.

Consider adding a brief comment above line 59 to document why sequential creation is necessary:

+      // Create login logs sequentially to ensure deterministic ID ordering
+      // for the ORDER BY id DESC query below (line 96)
       await vyom.createLoginLog();

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@WikiRik

WikiRik commented Oct 22, 2025

Copy link
Copy Markdown
Member Author

Fixed in #18037

@WikiRik
WikiRik deleted the WikiRik/flaky-mssql-test branch October 22, 2025 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant