MCPcopy
hub / github.com/moby/moby / TestServiceCreate

Function TestServiceCreate

client/service_create_test.go:39–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestServiceCreate(t *testing.T) {
40 const expectedURL = "/services/create"
41 client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) {
42 if err := assertRequest(req, http.MethodPost, expectedURL); err != nil {
43 return nil, err
44 }
45 return mockJSONResponse(http.StatusOK, nil, swarm.ServiceCreateResponse{
46 ID: "service_id",
47 })(req)
48 }))
49 assert.NilError(t, err)
50
51 r, err := client.ServiceCreate(t.Context(), ServiceCreateOptions{})
52 assert.NilError(t, err)
53 assert.Check(t, is.Equal(r.ID, "service_id"))
54}
55
56func TestServiceCreateCompatiblePlatforms(t *testing.T) {
57 client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) {

Callers

nothing calls this directly

Calls 8

WithMockClientFunction · 0.85
assertRequestFunction · 0.85
mockJSONResponseFunction · 0.85
CheckMethod · 0.80
EqualMethod · 0.80
NewFunction · 0.70
ServiceCreateMethod · 0.65
ContextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…