diff --git a/topic_test.go b/topic_test.go index a4bf9e4..a3f2e7a 100644 --- a/topic_test.go +++ b/topic_test.go @@ -619,7 +619,13 @@ func TestTopicRelayReuse(t *testing.T) { time.Sleep(time.Millisecond * 100) - if pubsubs[0].myRelays[topic] != 3 { + res := make(chan bool, 1) + pubsubs[0].eval <- func() { + res <- pubsubs[0].myRelays[topic] == 3 + } + + isCorrectNumber := <-res + if !isCorrectNumber { t.Fatal("incorrect number of relays") } @@ -629,7 +635,12 @@ func TestTopicRelayReuse(t *testing.T) { time.Sleep(time.Millisecond * 100) - if pubsubs[0].myRelays[topic] != 0 { + pubsubs[0].eval <- func() { + res <- pubsubs[0].myRelays[topic] == 0 + } + + isCorrectNumber = <-res + if !isCorrectNumber { t.Fatal("incorrect number of relays") } }