mirror of
https://github.com/go-sigma/sigma.git
synced 2026-10-28 15:34:34 +08:00
Add mock-based unit tests to five service packages, raising statement coverage on the business-logic layer: - distribution/upload: 5.6% -> 54.0% - distribution/blob: 9.8% -> 31.1% - daemons: 0.6% -> 48.6% - oauth2: 2.7% -> 22.8% - distribution/manifest: 27.1% -> 34.1% Tests cover error mapping (not-found vs internal), auth branches (Basic password verify / Bearer token validate), namespace ownership checks, GC rule/runner/record get-list across all four GC types, digest verification, redirect handling, and artifact-type classification. Transaction success paths (query.Q.Transaction) remain uncovered at the unit level by design, matching the existing service-test convention; those paths are exercised by handler/DB tests. Verification: - go test -count=1 -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./pkg/service/daemons/ ./pkg/service/oauth2/ ./pkg/service/distribution/manifest/ ./pkg/service/distribution/upload/ ./pkg/service/distribution/blob/ - go vet -tags "netgo,timetzdata,exclude_graphdriver_btrfs,containers_image_openpgp" ./pkg/service/daemons/ ./pkg/service/oauth2/ ./pkg/service/distribution/manifest/