Add -cpu 4 to tests.

This commit is contained in:
Tom Wilkie
2015-07-06 13:06:23 +00:00
parent 0043e9f37d
commit d2d73c3cd4
5 changed files with 34 additions and 27 deletions

View File

@@ -8,9 +8,12 @@ import (
"net/http"
"runtime"
"testing"
"time"
client "github.com/fsouza/go-dockerclient"
"github.com/weaveworks/scope/probe/docker"
"github.com/weaveworks/scope/test"
)
type mockConnection struct {
@@ -56,11 +59,10 @@ func TestContainer(t *testing.T) {
if err = json.NewEncoder(writer).Encode(&stats); err != nil {
t.Error(err)
}
runtime.Gosched() // wait for StartGatheringStats goroutine to receive the stats
// Now see if we go them
nmd := c.GetNodeMetadata()
if nmd[docker.MemoryUsage] != "12345" {
t.Errorf("want 12345, got %s", nmd[docker.MemoryUsage])
}
test.Poll(t, 10*time.Millisecond, func() bool {
nmd := c.GetNodeMetadata()
return nmd[docker.MemoryUsage] == "12345"
}, "Failed to get stats")
}

View File

@@ -160,13 +160,11 @@ func TestRegistry(t *testing.T) {
defer registry.Stop()
runtime.Gosched()
{
test.Poll(t, 10*time.Millisecond, func() bool {
have := allContainers(registry)
want := []docker.Container{&mockContainer{container1}}
if !reflect.DeepEqual(want, have) {
t.Errorf("%s", test.Diff(want, have))
}
}
return reflect.DeepEqual(want, have)
}, "Didn't get containers!")
{
have := allImages(registry)