Skip to content

test: improve unit test coverage and fix deprecation warnings - #1453

Open
kgala2 wants to merge 2 commits into
mainfrom
improve-coverage
Open

test: improve unit test coverage and fix deprecation warnings#1453
kgala2 wants to merge 2 commits into
mainfrom
improve-coverage

Conversation

@kgala2

@kgala2 kgala2 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Improved unit test coverage to 99% and fixed deprecation warnings for database parameters.

Detailed changes:

  • Added unit tests to cover missing statements in almost all modules.
  • Updated driver wrappers (asyncpg, pg8000, pymysql, pytds) to support both 'database' and 'db' parameters, ensuring explicit 'database' takes precedence over legacy 'db' to avoid deprecation warnings.
  • Updated all system tests to use 'database' parameter instead of 'db' to avoid warnings.
  • Added unit tests for all wrappers to verify both 'database' and 'db' parameters work.

New Unit Tests Breakdown (43 tests)

Category Test Count % of Total Key Impact
Connector Lifecycle & Cache 16 37.2% Ensures background refresh tasks, idempotency, and error-triggered refreshes work cleanly.
HTTP Retries & API Errors 9 20.9% Protects against transient Cloud SQL Admin API 50x errors and invalid server responses.
Parameter Compatibility 6 14.0% Prevents deprecation warnings and enforces database precedence.
Security, Auth & SSL/TLS 5 11.6% Validates token downscoping, IAM username limits, and TLS 1.3 fallback behavior.
Import Error Handling 4 9.3% Verifies clean ImportError messages for uninstalled database drivers.
DNS & Resolution Guardrails 3 7.0% Prevents infinite CNAME recursion loops and rejects invalid DNS/connection inputs.
Total 43 100%

- Added unit tests to cover missing statements in almost all modules.
- Updated driver wrappers (asyncpg, pg8000, pymysql, pytds) to support both 'database' and 'db' parameters, mapping 'db' to 'database' in pymysql to avoid deprecation warnings.
- Updated all system tests to use 'database' parameter instead of 'db' to avoid warnings.
- Added unit tests for all wrappers to verify both 'database' and 'db' parameters work.
@kgala2
kgala2 force-pushed the improve-coverage branch from df6c593 to 68635c6 Compare August 4, 2026 20:30
@kgala2
kgala2 marked this pull request as ready for review August 4, 2026 20:32
@kgala2
kgala2 requested a review from a team as a code owner August 4, 2026 20:32
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