Преглед на файлове

event/filter: hack around data race in the test

Péter Szilágyi преди 10 години
родител
ревизия
4541c22964
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      event/filter/filter_test.go

+ 6 - 1
event/filter/filter_test.go

@@ -1,6 +1,9 @@
 package filter
 package filter
 
 
-import "testing"
+import (
+	"testing"
+	"time"
+)
 
 
 func TestFilters(t *testing.T) {
 func TestFilters(t *testing.T) {
 	var success bool
 	var success bool
@@ -24,6 +27,8 @@ func TestFilters(t *testing.T) {
 	fm.Notify(Generic{Str1: "hello"}, true)
 	fm.Notify(Generic{Str1: "hello"}, true)
 	fm.Stop()
 	fm.Stop()
 
 
+	time.Sleep(10 * time.Millisecond) // yield to the notifier
+
 	if !success {
 	if !success {
 		t.Error("expected 'hello' to be posted")
 		t.Error("expected 'hello' to be posted")
 	}
 	}