mirror of
https://github.com/strukturag/nextcloud-spreed-signaling.git
synced 2023-10-21 07:33:40 -05:00
Don't start test until receiving goroutine is ready.
This commit is contained in:
@@ -65,8 +65,10 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
|
|||||||
|
|
||||||
received := int32(0)
|
received := int32(0)
|
||||||
max := int32(20)
|
max := int32(20)
|
||||||
|
ready := make(chan bool)
|
||||||
quit := make(chan bool)
|
quit := make(chan bool)
|
||||||
go func() {
|
go func() {
|
||||||
|
ready <- true
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-dest:
|
case <-dest:
|
||||||
@@ -84,6 +86,7 @@ func testNatsClient_Subscribe(t *testing.T, client NatsClient) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
<-ready
|
||||||
for i := int32(0); i < max; i++ {
|
for i := int32(0); i < max; i++ {
|
||||||
if err := client.Publish("foo", []byte("hello")); err != nil {
|
if err := client.Publish("foo", []byte("hello")); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user