14324: Use logrus in Azure driver. Fix Sirupsen->sirupsen in imports
[arvados.git] / lib / dispatchcloud / scheduler / run_queue_test.go
index 35db7052210ef8d1cbeb3d1a9cd86faf6920751f..8945f88a14385af1961f080f0e05601a994badeb 100644 (file)
@@ -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,