This commit is contained in:
David Oppenheimer 2015-07-05 21:31:54 -07:00
parent 9fbccb4ff7
commit 2e3f2ea20b
2 changed files with 22 additions and 23 deletions

View File

@ -20,8 +20,8 @@ import (
"math" "math"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource" "github.com/GoogleCloudPlatform/kubernetes/pkg/api/resource"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/algorithm" "github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/algorithm"
"github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/algorithm/predicates" "github.com/GoogleCloudPlatform/kubernetes/plugin/pkg/scheduler/algorithm/predicates"
"github.com/golang/glog" "github.com/golang/glog"

View File

@ -73,9 +73,9 @@ func TestZeroLimit(t *testing.T) {
Resources: api.ResourceRequirements{ Resources: api.ResourceRequirements{
Limits: api.ResourceList{ Limits: api.ResourceList{
"cpu": resource.MustParse( "cpu": resource.MustParse(
strconv.FormatInt(defaultMilliCpuLimit * 3, 10) + "m"), strconv.FormatInt(defaultMilliCpuLimit*3, 10) + "m"),
"memory": resource.MustParse( "memory": resource.MustParse(
strconv.FormatInt(defaultMemoryLimit * 3, 10)), strconv.FormatInt(defaultMemoryLimit*3, 10)),
}, },
}, },
}, },
@ -97,9 +97,9 @@ func TestZeroLimit(t *testing.T) {
{ {
pod: &api.Pod{Spec: noResources}, pod: &api.Pod{Spec: noResources},
// match current f1-micro on GCE // match current f1-micro on GCE
nodes: []api.Node{makeMinion("machine1", 1000, defaultMemoryLimit * 10), makeMinion("machine2", 1000, defaultMemoryLimit * 10)}, nodes: []api.Node{makeMinion("machine1", 1000, defaultMemoryLimit*10), makeMinion("machine2", 1000, defaultMemoryLimit*10)},
test: "test priority of zero-limit pod with machine with zero-limit pod", test: "test priority of zero-limit pod with machine with zero-limit pod",
pods: []*api.Pod { pods: []*api.Pod{
{Spec: large1}, {Spec: noResources1}, {Spec: large1}, {Spec: noResources1},
{Spec: large2}, {Spec: small2}, {Spec: large2}, {Spec: small2},
}, },
@ -107,9 +107,9 @@ func TestZeroLimit(t *testing.T) {
{ {
pod: &api.Pod{Spec: small}, pod: &api.Pod{Spec: small},
// match current f1-micro on GCE // match current f1-micro on GCE
nodes: []api.Node{makeMinion("machine1", 1000, defaultMemoryLimit * 10), makeMinion("machine2", 1000, defaultMemoryLimit * 10)}, nodes: []api.Node{makeMinion("machine1", 1000, defaultMemoryLimit*10), makeMinion("machine2", 1000, defaultMemoryLimit*10)},
test: "test priority of nonzero-limit pod with machine with zero-limit pod", test: "test priority of nonzero-limit pod with machine with zero-limit pod",
pods: []*api.Pod { pods: []*api.Pod{
{Spec: large1}, {Spec: noResources1}, {Spec: large1}, {Spec: noResources1},
{Spec: large2}, {Spec: small2}, {Spec: large2}, {Spec: small2},
}, },
@ -130,14 +130,13 @@ func TestZeroLimit(t *testing.T) {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }
for _, hp := range list { for _, hp := range list {
if (hp.Score != expectedPriority) { if hp.Score != expectedPriority {
t.Errorf("%s: expected 25 for all priorities, got list %#v", list) t.Errorf("%s: expected 25 for all priorities, got list %#v", list)
} }
} }
} }
} }
func TestLeastRequested(t *testing.T) { func TestLeastRequested(t *testing.T) {
labels1 := map[string]string{ labels1 := map[string]string{
"foo": "bar", "foo": "bar",