mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Merge pull request #521 from weaveworks/testing
Test for BackgroundPublisher
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"})
|
||||
|
||||
Reference in New Issue
Block a user