This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit 5cbfb6e
1 parent f796615 commit 5cbfb6e Copy full SHA for 5cbfb6e
File tree 2 files changed +23
-17
lines changed
2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -44,24 +44,30 @@ func TestNotifications(t *testing.T) {
44
44
continue
45
45
}
46
46
47
- cos := s .ConnectionsToPeer (s2 .LocalPeer ())
48
- func () {
49
- for i := 0 ; i < len (cos ); i ++ {
50
- var c inet.Conn
51
- select {
52
- case c = <- n .connected :
53
- case <- time .After (timeout ):
54
- t .Fatal ("timeout" )
55
- }
56
- for _ , c2 := range cos {
57
- if c == c2 {
58
- t .Log ("got notif for conn" , c )
59
- return
60
- }
47
+ var actual []inet.Conn
48
+ for len (s .ConnectionsToPeer (s2 .LocalPeer ())) != len (actual ) {
49
+ select {
50
+ case c := <- n .connected :
51
+ actual = append (actual , c )
52
+ case <- time .After (timeout ):
53
+ t .Fatal ("timeout" )
54
+ }
55
+ }
56
+
57
+ expect := s .ConnectionsToPeer (s2 .LocalPeer ())
58
+ for _ , c1 := range actual {
59
+ found := false
60
+ for _ , c2 := range expect {
61
+ if c1 == c2 {
62
+ found = true
63
+ break
61
64
}
62
- t .Error ("connection not found" , c )
63
65
}
64
- }()
66
+ if ! found {
67
+ t .Error ("connection not found" )
68
+ }
69
+ }
70
+
65
71
}
66
72
}
67
73
Original file line number Diff line number Diff line change @@ -325,6 +325,6 @@ func TestFilterBounds(t *testing.T) {
325
325
case <- time .After (time .Second ):
326
326
t .Fatal ("should have gotten connection" )
327
327
case <- conns :
328
- fmt . Println ("got connect" )
328
+ t . Log ("got connect" )
329
329
}
330
330
}
You can’t perform that action at this time.
0 commit comments