diff --git a/.travis.yml b/.travis.yml index 986ee9e5ed00d..29d616121be12 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ install: - ./hack/build-go.sh script: - - KUBE_TIMEOUT='-timeout 60s' ./hack/test-go.sh + - KUBE_RACE="-race" KUBE_COVER="-cover -covermode=atomic" KUBE_TIMEOUT='-timeout 60s' ./hack/test-go.sh - PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-cmd.sh - PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-integration.sh diff --git a/hack/test-go.sh b/hack/test-go.sh index f04af50915ee8..960568b092af8 100755 --- a/hack/test-go.sh +++ b/hack/test-go.sh @@ -44,9 +44,9 @@ kube::test::find_pkgs() { } # -covermode=atomic becomes default with -race in Go >=1.3 -KUBE_COVER="" #${KUBE_COVER:--cover -covermode=atomic} KUBE_TIMEOUT=${KUBE_TIMEOUT:--timeout 120s} -KUBE_RACE="" #${KUBE_RACE:--race} +KUBE_COVER=${KUBE_COVER:-} # use KUBE_COVER="-cover -covermode=atomic" for full coverage +KUBE_RACE=${KUBE_RACE:-} # use KUBE_RACE="-race" to enable race testing kube::test::usage() { kube::log::usage_from_stdin < 60*time.Second { - entry.backoff = 60 * time.Second + if entry.backoff > p.maxDuration { + entry.backoff = p.maxDuration } glog.V(4).Infof("Backing off %s for pod %s", duration.String(), podID) return duration @@ -282,7 +287,7 @@ func (p *podBackoff) gc() { defer p.lock.Unlock() now := p.clock.Now() for podID, entry := range p.perPodBackoff { - if now.Sub(entry.lastUpdate) > 60*time.Second { + if now.Sub(entry.lastUpdate) > p.maxDuration { delete(p.perPodBackoff, podID) } } diff --git a/plugin/pkg/scheduler/factory/factory_test.go b/plugin/pkg/scheduler/factory/factory_test.go index 6e3d30d75b56e..8e9b7c1ecd998 100644 --- a/plugin/pkg/scheduler/factory/factory_test.go +++ b/plugin/pkg/scheduler/factory/factory_test.go @@ -118,8 +118,10 @@ func TestDefaultErrorFunc(t *testing.T) { factory := NewConfigFactory(client.NewOrDie(&client.Config{Host: server.URL, Version: testapi.Version()})) queue := cache.NewFIFO() podBackoff := podBackoff{ - perPodBackoff: map[string]*backoffEntry{}, - clock: &fakeClock{}, + perPodBackoff: map[string]*backoffEntry{}, + clock: &fakeClock{}, + defaultDuration: 1 * time.Millisecond, + maxDuration: 1 * time.Second, } errFunc := factory.makeDefaultErrorFunc(&podBackoff, queue) @@ -203,8 +205,10 @@ func TestBind(t *testing.T) { func TestBackoff(t *testing.T) { clock := fakeClock{} backoff := podBackoff{ - perPodBackoff: map[string]*backoffEntry{}, - clock: &clock, + perPodBackoff: map[string]*backoffEntry{}, + clock: &clock, + defaultDuration: 1 * time.Second, + maxDuration: 60 * time.Second, } tests := []struct {