Skip to content

Commit

Permalink
Merge pull request #521 from weaveworks/testing
Browse files Browse the repository at this point in the history
Test for BackgroundPublisher
  • Loading branch information
tomwilkie committed Sep 28, 2015
2 parents b323388 + 8265aba commit ff6f87d
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 ff6f87d

Please sign in to comment.