Skip to content

Commit

Permalink
[FAB-12296] remove short timeout in TestTLSClient
Browse files Browse the repository at this point in the history
The negative test has been extracted to TestDialBadEndpoint and keeps
the short dial timeout duration.

Change-Id: I49188b593aeb52796f683eedba711feeaedeb7cd
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Oct 3, 2018
1 parent 51ec113 commit 6a32f28
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions cmd/common/comm/client_test.go
Expand Up @@ -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) {
Expand Down

0 comments on commit 6a32f28

Please sign in to comment.