| 67 | } |
| 68 | |
| 69 | func 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 | } |