Add tests for rotate CLI and request_rotation#76
Closed
gijzelaerr wants to merge 5 commits into
Closed
Conversation
`old_cert.endpoints` is a live SQLAlchemy relationship. When `request_rotation` reassigns `endpoint.certificate = new_cert`, the endpoint is removed from the collection mid-iteration, causing one endpoint to be skipped per rotation call. Wrap in `list()` to snapshot the collection before iterating.
Cover the two critical paths that had zero test coverage: 1. request_rotation: verifies it calls rotate_certificate, sends notifications, handles errors, and emits metrics. 2. Bulk rotation (rotate -o OLD -n NEW): regression test for the list-mutation bug where iterating old_cert.endpoints while request_rotation mutates it caused 1 endpoint to be skipped per rotation call. Tests that all 6 endpoints are rotated, not 5. Also covers single-endpoint rotation and dry-run mode.
Member
Author
|
Superseded by new PR based on main |
Coverage Report for CI Build 28863768566Coverage remained the same at 59.879%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds test coverage for two critical production paths that previously had zero tests:
request_rotation(5 tests)rotate_certificateand sends notification on commit--commit--messageBulk rotation
rotate -o OLD -n NEW(3 tests)old_cert.endpoints(a live SQLAlchemy relationship) whilerequest_rotationmutates it by reassigningendpoint.certificate.--commit) does not callrotate_certificateContext
The list-mutation bug was discovered during the
*.g2.spotify.comPhase 4 migration — 5 of 6 dealer SSL proxies rotated, 1 was silently skipped. The fix (PR #71) wraps the iterator inlist(), but without tests the regression could easily return.Based on old_fork (the known-good commit
7e11440c) sincemainhas a broken boto3 pin.