File tree Expand file tree Collapse file tree 1 file changed +11
-18
lines changed
Expand file tree Collapse file tree 1 file changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ package nodes
33import (
44 "context"
55 "os"
6- "sync"
76 "testing"
7+ "time"
88
99 "github.com/cryptopunkscc/astrald/astral"
1010 "github.com/cryptopunkscc/astrald/astral/log"
@@ -23,27 +23,20 @@ func Test_ConnectAccept(t *testing.T) {
2323 & Endpoint {address : "1" },
2424 & Endpoint {address : "2" },
2525 )
26-
27- ctx := context .Background ()
28- wg := sync.WaitGroup {}
29- wg .Add (2 )
30- go func () {
31- t .Log ("verify connect" )
26+ t .Run ("connect" , func (t * testing.T ) {
27+ t .Parallel ()
28+ ctx , cancel := context .WithTimeout (context .Background (), 1 * time .Second )
29+ defer cancel ()
3230 assert .NoError (t , m1 .Connect (ctx , n2 .Identity (), outConn ))
3331 assert .True (t , m1 .IsLinked (n2 .Identity ()))
34-
35- t .Log ("done 1" )
36- wg .Done ()
37- }()
38- go func () {
39- t .Log ("verify accept" )
32+ })
33+ t .Run ("accept" , func (t * testing.T ) {
34+ t .Parallel ()
35+ ctx , cancel := context .WithTimeout (context .Background (), 1 * time .Second )
36+ defer cancel ()
4037 assert .NoError (t , m2 .Accept (ctx , inConn ))
4138 assert .True (t , m2 .IsLinked (n1 .Identity ()))
42-
43- t .Log ("done 2" )
44- wg .Done ()
45- }()
46- wg .Wait ()
39+ })
4740}
4841
4942func newTestModule (t * testing.T ) (astral.Node , * nodes.Module ) {
You can’t perform that action at this time.
0 commit comments