Skip to content

Conversation

@NormB
Copy link
Owner

@NormB NormB commented Dec 30, 2025

Summary

Fixes race condition in PgBouncer test suite where tests would fail if PgBouncer was still initializing.

Problem

When running the full test suite immediately after starting services, PgBouncer tests would fail (1/10 passed) because:

  • Container was marked "healthy" but PgBouncer wasn't fully accepting connections
  • Tests would start before PgBouncer could respond to admin console commands

Solution

Added wait_for_pgbouncer() function that:

  1. Waits for container health status to be "healthy" (up to 30s)
  2. Waits for PgBouncer to accept connections and respond to SHOW VERSION command
  3. Only proceeds with tests once PgBouncer is fully operational

Test plan

  • Verified tests pass when PgBouncer is already running
  • Verified wait function correctly detects PgBouncer readiness
  • All 10 PgBouncer tests pass after fix

Added wait_for_pgbouncer() function that:
1. Waits for container health status to be "healthy"
2. Waits for PgBouncer to accept connections and respond to SHOW VERSION

This fixes race condition where tests would fail if PgBouncer was still
initializing when the test suite started, even though the container was
marked as healthy.
@NormB NormB merged commit 83ebfdd into main Dec 30, 2025
31 checks passed
@NormB NormB deleted the fix/pgbouncer-test-wait branch December 30, 2025 15:04
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.

2 participants