From 6a32f28cdc68a5eb8d8473bf3ae8f3f41af853d3 Mon Sep 17 00:00:00 2001 From: Matthew Sykes Date: Wed, 3 Oct 2018 16:29:01 -0400 Subject: [PATCH] [FAB-12296] remove short timeout in TestTLSClient The negative test has been extracted to TestDialBadEndpoint and keeps the short dial timeout duration. Change-Id: I49188b593aeb52796f683eedba711feeaedeb7cd Signed-off-by: Matthew Sykes --- cmd/common/comm/client_test.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cmd/common/comm/client_test.go b/cmd/common/comm/client_test.go index c1defd5c5a6..aa611299e6d 100644 --- a/cmd/common/comm/client_test.go +++ b/cmd/common/comm/client_test.go @@ -30,22 +30,26 @@ func TestTLSClient(t *testing.T) { assert.NoError(t, err) go srv.Start() defer srv.Stop() - conf := Config{ - Timeout: time.Millisecond * 100, - PeerCACertPath: filepath.Join("testdata", "server", "ca.pem"), - } + conf := Config{} cl, err := NewClient(conf) assert.NoError(t, err) _, port, _ := net.SplitHostPort(srv.Address()) - dial := cl.NewDialer(fmt.Sprintf("localhost:%s", port)) + dial := cl.NewDialer(net.JoinHostPort("localhost", port)) conn, err := dial() assert.NoError(t, err) conn.Close() +} - dial = cl.NewDialer(fmt.Sprintf("non_existent_host.xyz.blabla:%s", port)) +func TestDialBadEndpoint(t *testing.T) { + conf := Config{ + PeerCACertPath: filepath.Join("testdata", "server", "ca.pem"), + Timeout: 100 * time.Millisecond, + } + cl, err := NewClient(conf) + assert.NoError(t, err) + dial := cl.NewDialer("non_existent_host.xyz.blabla:9999") _, err = dial() assert.Error(t, err) - } func TestNonTLSClient(t *testing.T) {