MCPcopy
hub / github.com/moby/moby / TestVolumeUpdate

Function TestVolumeUpdate

client/volume_update_test.go:31–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestVolumeUpdate(t *testing.T) {
32 const (
33 expectedURL = "/volumes/test1"
34 expectedVersion = "version=10"
35 )
36
37 client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) {
38 if err := assertRequest(req, http.MethodPut, expectedURL); err != nil {
39 return nil, err
40 }
41 if !strings.Contains(req.URL.RawQuery, expectedVersion) {
42 return nil, fmt.Errorf("expected query to contain '%s', got '%s'", expectedVersion, req.URL.RawQuery)
43 }
44 return mockResponse(http.StatusOK, nil, "body")(req)
45 }))
46 assert.NilError(t, err)
47
48 _, err = client.VolumeUpdate(t.Context(), "test1", VolumeUpdateOptions{
49 Version: swarm.Version{Index: uint64(10)},
50 })
51 assert.NilError(t, err)
52}

Callers

nothing calls this directly

Calls 8

WithMockClientFunction · 0.85
assertRequestFunction · 0.85
mockResponseFunction · 0.85
ErrorfMethod · 0.80
NewFunction · 0.70
VolumeUpdateMethod · 0.65
ContextMethod · 0.65
ContainsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…