test(coverage/r2): drive storageprovider/r2 to ≥95%#27
Merged
Conversation
Adds r2_coverage_test.go covering uncovered branches: Name(), accessor methods (MasterAccessKey/MasterSecretKey/Endpoint/Bucket/PublicURL), New() master-key validation + endpoint/bucket defaults, apiBase() default branch, IssueTenantCredentials empty-prefix fallback + bucket override + trailing slash stripping, issueLongLivedKey HTTP error / invalid JSON / success=false / transport error, issueTempCreds HTTP error / invalid JSON / success=false / unparseable expiry / empty expiry / transport error, RevokeTenantCredentials HTTP error / 404 idempotency / transport error, customerEndpointURL public-URL + scheme-already-present branches, plus init() registration via storageprovider.Factory. Coverage: 69.6% → 95.5%. Remaining uncovered statements are defensive json.Marshal / http.NewRequestWithContext failure paths that aren't reachable without injecting a broken stdlib. 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
r2_coverage_test.gocovering uncovered branches incommon/storageprovider/r2.storageprovider/r2/(one new test file).What's covered
Name(), accessor getters (Master*, Endpoint, Bucket, PublicURL)New()master-key validation + endpoint/bucket default branchesapiBase()default branchIssueTenantCredentials: empty-prefix fallback, bucket override, trailing-slash stripissueLongLivedKey: HTTP error, invalid JSON, success=false, transport errorissueTempCreds: HTTP error, invalid JSON, success=false, unparseable expiry, empty expiry, transport errorRevokeTenantCredentials: HTTP error, 404 idempotency, transport errorcustomerEndpointURL: publicURL-set + scheme-already-presentinit()registration viastorageprovider.FactoryRemaining uncovered statements are defensive
json.Marshal/http.NewRequestWithContextfailure paths that aren't reachable without injecting a broken stdlib.Test plan
go test ./storageprovider/r2 -coverprofile=/tmp/r2-cov.out→ 95.5%go test ./...→ all packages PASSgo vet ./storageprovider/r2→ clean🤖 Generated with Claude Code