Skip to content

Fix flake in test_postgres_terminate_connection#1381

Merged
fizyk merged 1 commit into
mainfrom
deflake-test_postgres_terminate_connection
Jul 24, 2026
Merged

Fix flake in test_postgres_terminate_connection#1381
fizyk merged 1 commit into
mainfrom
deflake-test_postgres_terminate_connection

Conversation

@fizyk

@fizyk fizyk commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Improved connection-termination verification for both synchronous and asynchronous tests.
    • Updated the activity checks to restrict results to the active database, avoiding intermittent timeout failures caused by unrelated maintenance connections on some CI environments (e.g., macOS).

@fizyk fizyk self-assigned this Jul 24, 2026
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fizyk
fizyk force-pushed the deflake-test_postgres_terminate_connection branch from 6f72924 to 8977dc9 Compare July 24, 2026 10:33
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fc472378-ff1b-4ffa-8e93-15861eae4f5b

📥 Commits

Reviewing files that changed from the base of the PR and between 8977dc9 and 2751e65.

📒 Files selected for processing (2)
  • newsfragments/+deflake-terminate-connection.misc.rst
  • tests/test_postgresql.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • newsfragments/+deflake-terminate-connection.misc.rst
  • tests/test_postgresql.py

📝 Walkthrough

Walkthrough

The PostgreSQL termination tests now restrict synchronous and asynchronous activity queries to the current database. A news fragment records the deflake adjustment.

Changes

Terminate connection test scoping

Layer / File(s) Summary
Scope connection queries to the current database
tests/test_postgresql.py, newsfragments/+deflake-terminate-connection.misc.rst
Synchronous and asynchronous pg_stat_activity checks now filter by datname = current_database() alongside the client-backend filter, and the news fragment documents the change.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely matches the main change: deflaking test_postgres_terminate_connection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Newsfragment Check ✅ Passed A newsfragment was added at newsfragments/+deflake-terminate-connection.misc.rst, and pyproject.toml shows misc is a valid Towncrier type.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deflake-test_postgres_terminate_connection

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.

@fizyk
fizyk force-pushed the deflake-test_postgres_terminate_connection branch from 8977dc9 to 2751e65 Compare July 24, 2026 11:03
@fizyk
fizyk merged commit 2015557 into main Jul 24, 2026
57 checks passed
@fizyk
fizyk deleted the deflake-test_postgres_terminate_connection branch July 24, 2026 11:26
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