X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/cc952178056bf6d29471f6986306fb673dcf394a..443a0b96316ed46600dc5035193adae6ac4d1f74:/lib/dispatchcloud/scheduler/run_queue_test.go diff --git a/lib/dispatchcloud/scheduler/run_queue_test.go b/lib/dispatchcloud/scheduler/run_queue_test.go index 35db705221..8945f88a14 100644 --- a/lib/dispatchcloud/scheduler/run_queue_test.go +++ b/lib/dispatchcloud/scheduler/run_queue_test.go @@ -11,7 +11,7 @@ import ( "git.curoverse.com/arvados.git/lib/dispatchcloud/test" "git.curoverse.com/arvados.git/lib/dispatchcloud/worker" "git.curoverse.com/arvados.git/sdk/go/arvados" - "github.com/Sirupsen/logrus" + "github.com/sirupsen/logrus" check "gopkg.in/check.v1" ) @@ -72,7 +72,7 @@ func (p *stubPool) Shutdown(arvados.InstanceType) bool { p.shutdowns++ return false } -func (p *stubPool) Workers() map[worker.State]int { +func (p *stubPool) CountWorkers() map[worker.State]int { return map[worker.State]int{ worker.StateBooting: len(p.unalloc) - len(p.idle), worker.StateIdle: len(p.idle), @@ -165,14 +165,14 @@ func (*SchedulerSuite) TestUseIdleWorkers(c *check.C) { } } -// Shutdown some nodes if Create() fails -- and without even calling -// Create(), if AtQuota() is true. +// If Create() fails, shutdown some nodes, and don't call Create() +// again. Don't call Create() at all if AtQuota() is true. func (*SchedulerSuite) TestShutdownAtQuota(c *check.C) { for quota := 0; quota < 2; quota++ { c.Logf("quota=%d", quota) shouldCreate := []arvados.InstanceType{} for i := 0; i < quota; i++ { - shouldCreate = append(shouldCreate, test.InstanceType(1)) + shouldCreate = append(shouldCreate, test.InstanceType(3)) } queue := test.Queue{ ChooseType: func(ctr *arvados.Container) (arvados.InstanceType, error) { @@ -180,12 +180,21 @@ func (*SchedulerSuite) TestShutdownAtQuota(c *check.C) { }, Containers: []arvados.Container{ { - UUID: test.ContainerUUID(1), - Priority: 1, + UUID: test.ContainerUUID(2), + Priority: 2, State: arvados.ContainerStateLocked, RuntimeConstraints: arvados.RuntimeConstraints{ - VCPUs: 1, - RAM: 1 << 30, + VCPUs: 2, + RAM: 2 << 30, + }, + }, + { + UUID: test.ContainerUUID(3), + Priority: 3, + State: arvados.ContainerStateLocked, + RuntimeConstraints: arvados.RuntimeConstraints{ + VCPUs: 3, + RAM: 3 << 30, }, }, }, @@ -216,8 +225,8 @@ func (*SchedulerSuite) TestShutdownAtQuota(c *check.C) { func (*SchedulerSuite) TestStartWhileCreating(c *check.C) { pool := stubPool{ unalloc: map[arvados.InstanceType]int{ - test.InstanceType(1): 1, - test.InstanceType(2): 1, + test.InstanceType(1): 2, + test.InstanceType(2): 2, }, idle: map[arvados.InstanceType]int{ test.InstanceType(1): 1,