Skip to content

Commit

Permalink
Test for BackgroundPublisher
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Wilkie committed Sep 25, 2015
1 parent b323388 commit 8265aba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
26 changes: 24 additions & 2 deletions xfer/background_publisher_test.go
Original file line number Diff line number Diff line change
@@ -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
})
}
}
1 change: 1 addition & 0 deletions xfer/multi_publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down

0 comments on commit 8265aba

Please sign in to comment.