Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
f796615e
Commit
f796615e
authored
Jun 26, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mock: fix notif test
License: MIT Signed-off-by:
Juan Batiz-Benet
<
juan@benet.ai
>
parent
6b8e9f51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
p2p/net/mock/mock_notif_test.go
p2p/net/mock/mock_notif_test.go
+21
-15
No files found.
p2p/net/mock/mock_notif_test.go
View file @
f796615e
...
...
@@ -43,24 +43,30 @@ func TestNotifications(t *testing.T) {
for
i
,
s
:=
range
nets
{
n
:=
notifiees
[
i
]
for
_
,
s2
:=
range
nets
{
cos
:=
s
.
ConnsToPeer
(
s2
.
LocalPeer
())
func
()
{
for
i
:=
0
;
i
<
len
(
cos
);
i
++
{
var
c
inet
.
Conn
select
{
case
c
=
<-
n
.
connected
:
case
<-
time
.
After
(
timeout
)
:
t
.
Fatal
(
"timeout"
)
}
for
_
,
c2
:=
range
cos
{
if
c
==
c2
{
t
.
Log
(
"got notif for conn"
)
return
}
var
actual
[]
inet
.
Conn
for
len
(
s
.
ConnsToPeer
(
s2
.
LocalPeer
()))
!=
len
(
actual
)
{
select
{
case
c
:=
<-
n
.
connected
:
actual
=
append
(
actual
,
c
)
case
<-
time
.
After
(
timeout
)
:
t
.
Fatal
(
"timeout"
)
}
}
expect
:=
s
.
ConnsToPeer
(
s2
.
LocalPeer
())
for
_
,
c1
:=
range
actual
{
found
:=
false
for
_
,
c2
:=
range
expect
{
if
c1
==
c2
{
found
=
true
break
}
}
if
!
found
{
t
.
Error
(
"connection not found"
)
}
}()
}
}
}
...
...
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