Codebase list golang-github-go-kit-kit / f9d5ffa
This test is slightly flaky on CI Peter Bourgon 8 years ago
1 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2424 if err == nil {
2525 t.Errorf("expected error, got nil")
2626 }
27 calledEventHandler := false
27 calledEventHandler := make(chan struct{})
2828 eventHandler := func(event stdzk.Event) {
29 calledEventHandler = true
29 close(calledEventHandler)
3030 }
3131 c, err = NewClient(
3232 []string{"localhost"},
5757 if want, have := payload, clientImpl.rootNodePayload; bytes.Compare(want[0], have[0]) != 0 || bytes.Compare(want[1], have[1]) != 0 {
5858 t.Errorf("want %s, have %s", want, have)
5959 }
60 // Allow EventHandler to be called
61 time.Sleep(1 * time.Millisecond)
6260
63 if want, have := true, calledEventHandler; want != have {
64 t.Errorf("want %t, have %t", want, have)
61 select {
62 case <-calledEventHandler:
63 case <-time.After(100 * time.Millisecond):
64 t.Errorf("event handler never called")
6565 }
6666 }
6767