MCPcopy
hub / github.com/docker/compose / TestClientPing

Function TestClientPing

internal/desktop/client_test.go:69–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestClientPing(t *testing.T) {
70 if testing.Short() {
71 t.Skip("Skipped in short mode - test connects to Docker Desktop")
72 }
73 desktopEndpoint := os.Getenv("COMPOSE_TEST_DESKTOP_ENDPOINT")
74 if desktopEndpoint == "" {
75 t.Skip("Skipping - COMPOSE_TEST_DESKTOP_ENDPOINT not defined")
76 }
77
78 client := NewClient(desktopEndpoint)
79 t.Cleanup(func() {
80 _ = client.Close()
81 })
82
83 now := time.Now()
84
85 ret, err := client.Ping(t.Context())
86 assert.NilError(t, err)
87
88 serverTime := time.Unix(0, ret.ServerTime)
89 assert.Assert(t, now.Before(serverTime))
90}

Callers

nothing calls this directly

Calls 3

CloseMethod · 0.95
PingMethod · 0.95
NewClientFunction · 0.85

Tested by

no test coverage detected