(t *testing.T)
| 27 | } |
| 28 | |
| 29 | func TestFetchImageFailure(t *testing.T) { |
| 30 | testcase := []struct { |
| 31 | name string |
| 32 | client oci.Client |
| 33 | expectedErr error |
| 34 | }{ |
| 35 | { |
| 36 | name: "Fail to authorize with registry", |
| 37 | client: oci.AuthFailClient{}, |
| 38 | expectedErr: oci.ErrRegistryAuthz, |
| 39 | }, |
| 40 | { |
| 41 | name: "Fail to fetch image due to denial", |
| 42 | client: oci.DeniedClient{}, |
| 43 | expectedErr: oci.ErrDenied, |
| 44 | }, |
| 45 | } |
| 46 | |
| 47 | for _, tc := range testcase { |
| 48 | url := "example.com/repo:tag" |
| 49 | _, err := digestContainerImageArtifact(url, tc.client) |
| 50 | require.ErrorIs(t, err, tc.expectedErr) |
| 51 | } |
| 52 | } |
nothing calls this directly
no test coverage detected