Commit 6372f928 authored by Abhishek Upperwal's avatar Abhishek Upperwal
Browse files

Correct behaviour test for DefaultListenAddrs

parent 29af134a
......@@ -43,8 +43,18 @@ func TestInsecure(t *testing.T) {
func TestDefaultListenAddrs(t *testing.T) {
ctx := context.Background()
// Test 1: Listen addr should not set if user defined transport is passed.
h, err := New(
// Test 1: Setting the correct listen addresses if userDefined.Transport == nil && userDefined.ListenAddrs == nil
h, err := New(ctx)
if err != nil {
t.Fatal(err)
}
if len(h.Addrs()) != 2 {
t.Error("expected 2 default listen addrs")
}
h.Close()
// Test 2: Listen addr should not set if user defined transport is passed.
h, err = New(
ctx,
Transport(tcp.NewTCPTransport),
)
......@@ -57,7 +67,7 @@ func TestDefaultListenAddrs(t *testing.T) {
}
h.Close()
// Test 2: User defined listener addrs should overwrite the default options.
// Test 3: User defined listener addrs should overwrite the default options.
h, err = New(
ctx,
Transport(tcp.NewTCPTransport),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment