Files
sigma/pkg
Tosone 2723ffb4b0 test(service): add unit tests for distribution, daemons, oauth2, and manifest services
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/
2026-09-14 23:19:12 +08:00
..
2026-08-01 20:32:49 +08:00