-
Notifications
You must be signed in to change notification settings - Fork 16
FIX: Connection pooling flaky tests #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses flaky connection pooling tests by improving test reliability and adding more comprehensive validation. The changes focus on making the connection pooling tests more robust and deterministic.
- Enhanced connection speed comparison tests with statistical averaging and warm-up procedures
- Added new test to verify actual connection reuse through SQL Server Process ID (SPID) validation
- Improved test isolation with explicit pooling state management
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added couple of comments. Please validate
Work Item / Issue Reference
Summary
This pull request enhances the connection pooling tests in
tests/test_003_connection.py
by introducing more detailed and robust test cases. The changes include adding new tests for connection pooling performance and connection reuse, as well as improving the structure and clarity of the existing test logic.Enhancements to connection pooling tests:
Performance testing for pooled vs. non-pooled connections:
test_connection_pooling_speed
) to measure and compare the average time taken for establishing connections with and without pooling. The test ensures that pooled connections are at least 20% faster than non-pooled connections.Connection reuse validation:
test_connection_pooling_reuse_spid
) to verify that connections are reused from the pool. The test checks that the SQL Server process ID (SPID
) remains consistent across reused connections, indicating proper pooling behavior.Improved test setup and cleanup:
These changes improve the reliability and comprehensiveness of the connection pooling tests.