Skip to content

Commit 3996b2e

Browse files
committed
Add tests
Signed-off-by: Levi Harrison <[email protected]>
1 parent dd65f9c commit 3996b2e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Diff for: config/http_config_test.go

+17
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,23 @@ func TestCustomDialContextFunc(t *testing.T) {
545545
}
546546
}
547547

548+
func TestCustomDialTLSContextFunc(t *testing.T) {
549+
dialFn := func(_ context.Context, _, _ string) (net.Conn, error) {
550+
return nil, errors.New(ExpectedError)
551+
}
552+
553+
cfg := HTTPClientConfig{}
554+
client, err := NewClientFromConfig(cfg, "test", WithDialTLSContextFunc(dialFn))
555+
if err != nil {
556+
t.Fatalf("Can't create a client from this config: %+v", cfg)
557+
}
558+
559+
_, err = client.Get("https://localhost")
560+
if err == nil || !strings.Contains(err.Error(), ExpectedError) {
561+
t.Errorf("Expected error %q but got %q", ExpectedError, err)
562+
}
563+
}
564+
548565
func TestCustomIdleConnTimeout(t *testing.T) {
549566
timeout := time.Second * 5
550567

0 commit comments

Comments
 (0)