Skip to content

fix(test): Try to unflake the test_graceful_shutdown_with_sqlite_bufer#5729

Merged
olksdr merged 3 commits intomasterfrom
fix/flake_of_test_graceful_shutdown_with_sqlite_buffer
Mar 16, 2026
Merged

fix(test): Try to unflake the test_graceful_shutdown_with_sqlite_bufer#5729
olksdr merged 3 commits intomasterfrom
fix/flake_of_test_graceful_shutdown_with_sqlite_buffer

Conversation

@olksdr
Copy link
Contributor

@olksdr olksdr commented Mar 16, 2026

Trying to improve and fix the flaky test.
The CI job logs have expired.
However I can reproduce some flakiness locally so I’ve fixed that part I saw in the reproductions.

fix: RELAY-176

@olksdr olksdr self-assigned this Mar 16, 2026
@olksdr olksdr requested a review from a team as a code owner March 16, 2026 13:02
@linear-code
Copy link

linear-code bot commented Mar 16, 2026

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: sqlite3 context manager doesn't close the connection
    • Replaced with sqlite3.connect(...) with an explicit connection and finally: conn.close() so the SQLite handle is always closed before temporary directory cleanup.

Create PR

Or push these changes by commenting:

@cursor push 9668ec0f9f
Preview (9668ec0f9f)
diff --git a/tests/integration/test_basic.py b/tests/integration/test_basic.py
--- a/tests/integration/test_basic.py
+++ b/tests/integration/test_basic.py
@@ -85,10 +85,13 @@
         assert mini_sentry.captured_envelopes.empty()
 
         # Check if there's data in the SQLite table `envelopes`.
-        with sqlite3.connect(db_file_path) as conn:
+        conn = sqlite3.connect(db_file_path)
+        try:
             cursor = conn.cursor()
             cursor.execute("SELECT COALESCE(SUM(count), 0) FROM envelopes")
             row_count = cursor.fetchone()[0]
+        finally:
+            conn.close()
 
         assert (
             row_count == n

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

olksdr added 2 commits March 16, 2026 15:00
Ensure the sqlite handle is explicitly closed after reading the spool table.
@olksdr olksdr added this pull request to the merge queue Mar 16, 2026
Merged via the queue into master with commit cf03969 Mar 16, 2026
30 checks passed
@olksdr olksdr deleted the fix/flake_of_test_graceful_shutdown_with_sqlite_buffer branch March 16, 2026 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants