Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
6372f928
Commit
6372f928
authored
Jul 27, 2018
by
Abhishek Upperwal
Browse files
Correct behaviour test for DefaultListenAddrs
parent
29af134a
Changes
1
Show whitespace changes
Inline
Side-by-side
libp2p_test.go
View file @
6372f928
...
@@ -43,8 +43,18 @@ func TestInsecure(t *testing.T) {
...
@@ -43,8 +43,18 @@ func TestInsecure(t *testing.T) {
func
TestDefaultListenAddrs
(
t
*
testing
.
T
)
{
func
TestDefaultListenAddrs
(
t
*
testing
.
T
)
{
ctx
:=
context
.
Background
()
ctx
:=
context
.
Background
()
// Test 1: Listen addr should not set if user defined transport is passed.
// Test 1: Setting the correct listen addresses if userDefined.Transport == nil && userDefined.ListenAddrs == nil
h
,
err
:=
New
(
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
,
ctx
,
Transport
(
tcp
.
NewTCPTransport
),
Transport
(
tcp
.
NewTCPTransport
),
)
)
...
@@ -57,7 +67,7 @@ func TestDefaultListenAddrs(t *testing.T) {
...
@@ -57,7 +67,7 @@ func TestDefaultListenAddrs(t *testing.T) {
}
}
h
.
Close
()
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
(
h
,
err
=
New
(
ctx
,
ctx
,
Transport
(
tcp
.
NewTCPTransport
),
Transport
(
tcp
.
NewTCPTransport
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment