Update HTTPFallback to handle tls handshake timeout

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2024-04-14 18:46:39 -07:00
parent 7c50784591
commit 5e470e1cae
5 changed files with 107 additions and 25 deletions

View File

@@ -472,11 +472,11 @@ func TestHTTPFallback(t *testing.T) {
if testHosts[0].Scheme != tc.expectedScheme {
t.Fatalf("expected %s scheme for localhost with tls config, got %q", tc.expectedScheme, testHosts[0].Scheme)
}
_, ok := testHosts[0].Client.Transport.(docker.HTTPFallback)
if tc.usesFallback && !ok {
_, defaultTransport := testHosts[0].Client.Transport.(*http.Transport)
if tc.usesFallback && defaultTransport {
t.Fatal("expected http fallback configured for defaulted localhost endpoint")
} else if ok && !tc.usesFallback {
t.Fatal("expected no http fallback configured for defaulted localhost endpoint")
} else if !defaultTransport && !tc.usesFallback {
t.Fatalf("expected no http fallback configured for defaulted localhost endpoint")
}
})
}