diff --git a/xfer/background_publisher_test.go b/xfer/background_publisher_test.go index 60a1a6283d..c4eeffc9b2 100644 --- a/xfer/background_publisher_test.go +++ b/xfer/background_publisher_test.go @@ -1,7 +1,29 @@ package xfer_test -import "testing" +import ( + "bytes" + "runtime" + "testing" + "time" + + "github.com/weaveworks/scope/test" + "github.com/weaveworks/scope/xfer" +) func TestBackgroundPublisher(t *testing.T) { - t.Skip("TODO") + mp := mockPublisher{} + backgroundPublisher := xfer.NewBackgroundPublisher(&mp) + defer backgroundPublisher.Stop() + runtime.Gosched() + + for i := 0; i < 10; i++ { + err := backgroundPublisher.Publish(&bytes.Buffer{}) + if err != nil { + t.Fatalf("%v", err) + } + + test.Poll(t, 100*time.Millisecond, i, func() interface{} { + return mp.count + }) + } } diff --git a/xfer/multi_publisher_test.go b/xfer/multi_publisher_test.go index 2664340b7d..943f4dca9a 100644 --- a/xfer/multi_publisher_test.go +++ b/xfer/multi_publisher_test.go @@ -33,6 +33,7 @@ func TestMultiPublisher(t *testing.T) { return "", nil, fmt.Errorf("invalid endpoint %s", endpoint) } }) + defer mp.Stop() mp.Set("a", []string{"a1", "a2"}) mp.Set("b", []string{"b2", "b3"})