Skip to content

fix: use serial_test for env var tests to prevent race conditions#213

Merged
joshrotenberg merged 1 commit intomainfrom
fix/env-test-race-condition
Jan 5, 2026
Merged

fix: use serial_test for env var tests to prevent race conditions#213
joshrotenberg merged 1 commit intomainfrom
fix/env-test-race-condition

Conversation

@joshrotenberg
Copy link
Copy Markdown
Owner

@joshrotenberg joshrotenberg commented Jan 5, 2026

Summary

Fixes two flaky test issues:

1. Environment variable test race condition

test_redis_cluster_from_env_with_vars was failing because environment variable tests were racing against each other when running in parallel.

assertion `left == right` failed
  left: 3
 right: 6

Fix: Added serial_test as a dev dependency and marked both env var tests with #[serial].

2. MySQL readiness check too early

test_mysql_basic_start_stop was failing with:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

The mysqladmin ping check can succeed before the socket is fully ready for client connections.

Fix: Changed the readiness check to use mysql -e 'SELECT 1' which is the same operation the tests perform, ensuring the socket is fully ready.

@joshrotenberg joshrotenberg force-pushed the fix/env-test-race-condition branch from a51a21f to 6cdcc05 Compare January 5, 2026 21:01
- Added serial_test dependency for tests that modify environment variables
- Marked env var tests with #[serial] to prevent race conditions
- Changed MySQL readiness check to use TCP (127.0.0.1) instead of Unix socket
- Require 2 consecutive successful connections before declaring ready
- Updated test to also use TCP connection for consistency
@joshrotenberg joshrotenberg force-pushed the fix/env-test-race-condition branch from 6cdcc05 to eeedc43 Compare January 5, 2026 21:06
@joshrotenberg joshrotenberg merged commit 01bf931 into main Jan 5, 2026
13 checks passed
@joshrotenberg joshrotenberg deleted the fix/env-test-race-condition branch January 5, 2026 21:18
@github-actions github-actions Bot mentioned this pull request Jan 5, 2026
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