MCPcopy
hub / github.com/moby/moby / TestServiceCreateConnectionError

Function TestServiceCreateConnectionError

client/service_create_test.go:31–37  ·  view source on GitHub ↗

TestServiceCreateConnectionError verifies that connection errors occurring during API-version negotiation are not shadowed by API-version errors. Regression test for https://github.com/docker/cli/issues/4890

(t *testing.T)

Source from the content-addressed store, hash-verified

29//
30// Regression test for https://github.com/docker/cli/issues/4890
31func TestServiceCreateConnectionError(t *testing.T) {
32 client, err := New(WithHost("tcp://no-such-host.invalid"))
33 assert.NilError(t, err)
34
35 _, err = client.ServiceCreate(t.Context(), ServiceCreateOptions{})
36 assert.Check(t, is.ErrorType(err, IsErrConnectionFailed))
37}
38
39func TestServiceCreate(t *testing.T) {
40 const expectedURL = "/services/create"

Callers

nothing calls this directly

Calls 5

WithHostFunction · 0.85
CheckMethod · 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…