test(jobs): drive expiry/reaper coverage to 95%#51
Merged
Conversation
Cover the anon-TTL reaper, 6/2/1h imminent + reminder cadence, stack expiry (incl. the in-cluster k8s namespace teardown path), pending- deletion expirer, and magic-link reconciler. Adds in-package tests for unexported seams: deprovisionMinIOUser, deleteStorageObjects, the in-cluster ExpireStacks Work branch, signMagicLinkResendJWT, and rows.Err propagation. expire_stacks.go's hardcoded SA-token/CA paths + k8s API base become test-overridable package vars (identical prod defaults, no behavior change). Aggregate target-file coverage 87% → 95%. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The storage-object reaper incremented objectCount in the producer goroutine and read it in the post-drain slog with no happens-before guarantee. CI's -race build (which the new coverage tests now exercise end-to-end) flagged it. Promote to atomic.Int64. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
worker/internal/jobsto 95.1% aggregate statement coverage (was 87%).deprovisionMinIOUser(madmin client vs httptest),deleteStorageObjects(empty-prefix + list/remove paths), the in-clusterExpireStacks.Workk8s namespace teardown branch,signMagicLinkResendJWT,driveResendJWT-sign failure, androws.Errpropagation in expire_imminent/expiry_reminder.expire_stacks.go: the hardcoded SA-token/CA paths + k8s API base URL become test-overridable package vars (identical prod defaults — no behavior change).Per-file coverage
*Remaining uncovered lines are genuinely unreachable defensive branches:
json.Marshalof a primitive map, andtemplate.Executefallbacks for templates already validated bytemplate.Mustat init.Test plan
go build ./... && go vet ./...cleango test ./... -short -count=1green (all packages)🤖 Generated with Claude Code