X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ca2d946973b6ae25dd594ddecec54e02b83bc44e..4257184a0fd276af7e1741dda8a7468a30b4a9c6:/lib/dispatchcloud/worker/worker_test.go diff --git a/lib/dispatchcloud/worker/worker_test.go b/lib/dispatchcloud/worker/worker_test.go index 3bc33b62c9..943fa7c710 100644 --- a/lib/dispatchcloud/worker/worker_test.go +++ b/lib/dispatchcloud/worker/worker_test.go @@ -25,7 +25,8 @@ func (suite *WorkerSuite) TestProbeAndUpdate(c *check.C) { bootTimeout := time.Minute probeTimeout := time.Second - is, err := (&test.StubDriver{}).InstanceSet(nil, "", logger) + ac := arvados.NewClientFromEnv() + is, err := (&test.StubDriver{}).InstanceSet(nil, "test-instance-set-id", nil, logger) c.Assert(err, check.IsNil) inst, err := is.Create(arvados.InstanceType{}, "", nil, "echo InitCommand", nil) c.Assert(err, check.IsNil) @@ -192,6 +193,7 @@ func (suite *WorkerSuite) TestProbeAndUpdate(c *check.C) { "crunch-run --list": trial.respRun, } wp := &Pool{ + arvClient: ac, newExecutor: func(cloud.Instance) Executor { return exr }, bootProbeCommand: "bootprobe", timeoutBooting: bootTimeout, @@ -209,12 +211,17 @@ func (suite *WorkerSuite) TestProbeAndUpdate(c *check.C) { busy: ctime, probed: ctime, updated: ctime, + running: map[string]*remoteRunner{}, + starting: map[string]*remoteRunner{}, + probing: make(chan struct{}, 1), } if trial.running > 0 { - wkr.running = map[string]struct{}{"zzzzz-dz642-abcdefghijklmno": struct{}{}} + uuid := "zzzzz-dz642-abcdefghijklmno" + wkr.running = map[string]*remoteRunner{uuid: newRemoteRunner(uuid, wkr)} } if trial.starting > 0 { - wkr.starting = map[string]struct{}{"zzzzz-dz642-abcdefghijklmno": struct{}{}} + uuid := "zzzzz-dz642-bcdefghijklmnop" + wkr.starting = map[string]*remoteRunner{uuid: newRemoteRunner(uuid, wkr)} } wkr.probeAndUpdate() c.Check(wkr.state, check.Equals, trial.expectState)