You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve TLS testing infrastructure and reliability
This change consolidates duplicate certificate generation code and improves
test infrastructure reliability based on code review feedback.
Key improvements:
1. Consolidate Certificate Generation Utilities:
- Removed three separate and nearly identical certificate generation
helper functions from https_client.rs, registration.rs, and
registrar_client.rs (261 lines of duplicate code eliminated)
- Introduced a single, comprehensive utility function
crypto::testing::generate_tls_certs_for_test that creates CA,
server, and client certificate sets for testing purposes
- All relevant tests refactored to use this new shared utility,
reducing code duplication and improving maintainability
2. Strengthen Mockoon TLS Test Assertion:
- Fixed weak assertion assert!(result.is_err() || result.is_ok()) in
test_mockoon_registrar_https_registration test
- Changed to assert!(result.is_err()) to specifically verify that
connection fails as expected when mock server lacks TLS configuration
3. Replace Brittle Sleep with Polling Mechanism:
- Replaced sleep 3 command in tests/mockoon_registrar_tests.sh with
robust polling loop using curl to check server responsiveness
- Added 15-second timeout with proper error handling
- Makes tests less prone to failures on slower or busier CI runners
Co-Authored-By: Gemini <[email protected]>
Co-Authored-By: Claude <[email protected]>
Signed-off-by: Sergio Arroutbi <[email protected]>
0 commit comments