[quality] test: cover pkg/hubbackup sealed-archive error branches (Build/Finish seal failures, Verify malformed plaintext, Extract fs errors, VerifyLatest store errors) - #6220
Conversation
Covers the reachable error branches the happy-path suites left unexercised, raising pkg/hubbackup coverage from 92.7% to 95.8%: - Build/Builder.Finish seal failure with a non-AES-256 key, double Finish, and AddBytes after Finish (backup.go, builder_export.go) - builder.addTree missing root and excludedDirs subtree pruning; exported AddTree per-file skip callback (builder_export.go:74) - Verify on sealed-but-malformed plaintext: non-gzip and non-tar streams (backup.go:484, :498) - Extract filesystem failures: parent path occupied by a file, member path occupied by a directory (backup.go:570, :573) - parseSpokeStream flush failure on the NEXT @@file@@ marker (collect.go:424) - NewObjectStore unparseable key bytes and region default (objectstore.go:129, :140); do() invalid method and dead endpoint (objectstore.go:220, :228) - VerifyLatest store-error paths: missing credentials, failing List, failing Get (run.go:181, :185, :192) - Run tolerates a failed Prune as a warning (run.go:168) Test-only change; no production code touched. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality-agent <sec-check@hive.kubestellar.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Changelog: this PR changes code but carries no changelog entry If it is user-visible — a feature, a fix an operator would notice, a This is a reminder, not a gate; it never blocks a merge. |
Test Improvement
Adds
src/pkg/hubbackup/error_branches_test.gocovering the reachable error branches the existing happy-path suites leave unexercised. Package coverage: 92.7% → 95.8%, all existing tests unchanged and passing.Branches covered (file:line of the previously-uncovered block)
Buildwith a non-AES-256 key (backup.go:470),Builder.Finishseal failure (builder_export.go:130), doubleFinish(builder_export.go:112),AddBytesafterFinish(backup.go:318)builder.addTreemissing root warn-and-skip (backup.go:337),excludedDirssubtree pruning (backup.go:349), exportedAddTreeper-file skip callback (builder_export.go:74)backup.go:484) and gzip-but-not-tar (backup.go:498) streamsbackup.go:570), member path occupied by a directory (backup.go:573)@@FILE@@marker (collect.go:424)objectstore.go:129), region default (objectstore.go:140),do()invalid method (objectstore.go:220) and dead endpoint (objectstore.go:228)run.go:181), failing List (run.go:185), failing Get (run.go:192)Pruneis a warning, not a failed backup (run.go:168)Remaining uncovered blocks in the package are defense-in-depth branches that are practically unreachable (GCM construction on a valid AES block, tar/gzip writes into a
strings.Builder, post-Verify re-decode paths inExtract, RSA sign failure, the 256 MiB decompression-bomb member).Validation
go test -count=1 -coverprofile ./pkg/hubbackup→ ok, 95.8% of statements;go vet ./pkg/hubbackupclean; new file is gofmt-clean.Disjointness
No open PR touches
pkg/hubbackup; this claims onlysrc/pkg/hubbackup/error_branches_test.go(new file). Test-only change — no production code touched.Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5