Merge pull request #4353 from gaurav1086/TestExchangeBasic_fix_deadlock

[events] Fix deadlock in TestExchangeBasic
This commit is contained in:
Akihiro Suda
2020-07-06 18:03:07 +09:00
committed by GitHub

View File

@@ -52,11 +52,8 @@ func TestExchangeBasic(t *testing.T) {
eventq2, errq2 := exchange.Subscribe(ctx2)
t.Log("publish")
var wg sync.WaitGroup
wg.Add(1)
errChan := make(chan error)
go func() {
defer wg.Done()
defer close(errChan)
for _, event := range testevents {
if err := exchange.Publish(ctx, "/test", event); err != nil {
@@ -69,7 +66,6 @@ func TestExchangeBasic(t *testing.T) {
}()
t.Log("waiting")
wg.Wait()
if err := <-errChan; err != nil {
t.Fatal(err)
}