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
126c2b39
Commit
126c2b39
authored
Jan 13, 2015
by
Juan Batiz-Benet
Browse files
p2p/net/swarm: fix racey test
parent
ebb51b28
Changes
1
Hide whitespace changes
Inline
Side-by-side
net/swarm/swarm_addr_test.go
View file @
126c2b39
...
...
@@ -26,13 +26,13 @@ func TestFilterAddrs(t *testing.T) {
m
(
"/ip4/1.2.3.4/udp/1234/sctp/1234"
),
// not in manet
m
(
"/ip4/1.2.3.4/udp/1234/utp"
),
// utp is broken
m
(
"/ip4/1.2.3.4/udp/1234/udt"
),
// udt is broken on arm
m
(
"/ip6/fe80::1/tcp/
1234"
),
// link local
m
(
"/ip6/fe80::1/tcp/
0"
),
// link local
m
(
"/ip6/fe80::100/tcp/1234"
),
// link local
}
good
:=
[]
ma
.
Multiaddr
{
m
(
"/ip4/127.0.0.1/tcp/
1234
"
),
m
(
"/ip6/::1/tcp/
1234
"
),
m
(
"/ip4/127.0.0.1/tcp/
0
"
),
m
(
"/ip6/::1/tcp/
0
"
),
}
goodAndBad
:=
append
(
good
,
bad
...
)
...
...
@@ -69,13 +69,9 @@ func TestFilterAddrs(t *testing.T) {
t
.
Fatal
(
"should have failed to create swarm"
)
}
if
_
,
err
:=
NewNetwork
(
ctx
,
good
,
id
,
ps
);
err
!=
nil
{
if
_
,
err
:=
NewNetwork
(
ctx
,
good
AndBad
,
id
,
ps
);
err
!=
nil
{
t
.
Fatal
(
"should have succeeded in creating swarm"
,
err
)
}
if
_
,
err
:=
NewNetwork
(
ctx
,
goodAndBad
,
id
,
ps
);
err
==
nil
{
t
.
Fatal
(
"should have failed to create swarm"
)
}
}
func
subtestAddrsEqual
(
t
*
testing
.
T
,
a
,
b
[]
ma
.
Multiaddr
)
{
...
...
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