Skip to content

test(database): lock tests wait for the lock itself, so a slow machine can't fail them - #412

Merged
PiquelChips merged 1 commit into
mainfrom
test/lock-waits
Nov 7, 2026
Merged

PiquelChips merged 1 commit into
mainfrom
test/lock-waits

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Two database lock tests checked that a lookup waits for a lock by sleeping 200 ms, then asserting the lookup hadn't finished. On a slow machine that could fail, and a lookup that never blocked could pass by being slow. This is a follow-up to the test cleanup; #405 added the lock-wait helpers.

Both tests now wait until the lookup's own backend shows as blocked on a lock in pg_stat_activity (Database::wait_for_lock), as the token and deletion tests already do:

  • locked_session_lookup_waits_for_concurrent_logout
  • locked_lookups_read_a_rename_they_waited_for

Proved by: both tests passing against a scratch cluster, and clippy -D warnings on piquel-repository.

Reviewed with review-loop: 1 round with 2× GPT 6.1 Sol and Claude Opus 5.5. Verdict: approved

Note

Written by Claude Opus 5.5 in Claude Code and reviewed by GPT 6.1 Sol and Claude Opus 5.5 (via T3 Code)

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0137b0ea-d49c-4415-b994-4aad438d68ac
Commits

Reviewing files that changed from the base of the PR and between b7d1ef4 and 4ae2702.

Files selected for processing: 2

  • crates/database/src/repositories/handles/tests.rs
  • crates/database/src/repositories/users/tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Base automatically changed from test/cleanup-database to main November 6, 2026 23:37
@PiquelChips PiquelChips self-assigned this Nov 6, 2026
@PiquelChips PiquelChips added the tests Tests label Nov 7, 2026
@PiquelChips PiquelChips added this to the v0.1 milestone Nov 7, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in sourceorigin.dev Nov 7, 2026
@PiquelChips PiquelChips moved this from Needs Triage to In Progress in sourceorigin.dev Nov 7, 2026
@PiquelChips PiquelChips moved this from In Progress to Ready in sourceorigin.dev Nov 7, 2026
@PiquelChips
PiquelChips added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 464b6db Nov 7, 2026
9 checks passed
@PiquelChips
PiquelChips deleted the test/lock-waits branch November 7, 2026 00:09
@github-project-automation github-project-automation Bot moved this from Ready to Done in sourceorigin.dev Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant