MCPcopy Index your code
hub / github.com/moby/moby / TestImagePushReferenceError

Function TestImagePushReferenceError

client/image_push_test.go:17–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestImagePushReferenceError(t *testing.T) {
18 client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) {
19 return nil, nil
20 }))
21 assert.NilError(t, err)
22 // An empty reference is an invalid reference
23 _, err = client.ImagePush(t.Context(), "", ImagePushOptions{})
24 assert.Check(t, is.ErrorContains(err, "invalid reference format"))
25 // A canonical reference cannot be pushed
26 _, err = client.ImagePush(t.Context(), "repo@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ImagePushOptions{})
27 assert.Check(t, is.Error(err, "cannot push a digest reference"))
28}
29
30func TestImagePushAnyError(t *testing.T) {
31 client, err := New(WithMockClient(errorMock(http.StatusInternalServerError, "Server error")))

Callers

nothing calls this directly

Calls 6

WithMockClientFunction · 0.85
CheckMethod · 0.80
NewFunction · 0.70
ImagePushMethod · 0.65
ContextMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…