X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f6d551a68e30f533676bcf7ed17b199b21990c7b..87bf45c8c4db3c7dd58edabab429286dcabfcd7d:/lib/dispatchcloud/test/stub_driver.go diff --git a/lib/dispatchcloud/test/stub_driver.go b/lib/dispatchcloud/test/stub_driver.go index d81382a301..5873e49221 100644 --- a/lib/dispatchcloud/test/stub_driver.go +++ b/lib/dispatchcloud/test/stub_driver.go @@ -62,6 +62,7 @@ func (sd *StubDriver) InstanceSet(params json.RawMessage, id cloud.InstanceSetID } sis := StubInstanceSet{ driver: sd, + logger: logger, servers: map[cloud.InstanceID]*StubVM{}, } sd.instanceSets = append(sd.instanceSets, &sis) @@ -91,6 +92,7 @@ func (sd *StubDriver) ReleaseCloudOps(n int) { type StubInstanceSet struct { driver *StubDriver + logger logrus.FieldLogger servers map[cloud.InstanceID]*StubVM mtx sync.RWMutex stopped bool @@ -99,7 +101,7 @@ type StubInstanceSet struct { allowInstancesCall time.Time } -func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID, tags cloud.InstanceTags, authKey ssh.PublicKey) (cloud.Instance, error) { +func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID, tags cloud.InstanceTags, cmd cloud.InitCommand, authKey ssh.PublicKey) (cloud.Instance, error) { if sis.driver.HoldCloudOps { sis.driver.holdCloudOps <- true } @@ -123,6 +125,7 @@ func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID, id: cloud.InstanceID(fmt.Sprintf("stub-%s-%x", it.ProviderType, math_rand.Int63())), tags: copyTags(tags), providerType: it.ProviderType, + initCommand: cmd, } svm.SSHService = SSHService{ HostKey: sis.driver.HostKey, @@ -184,6 +187,7 @@ type StubVM struct { sis *StubInstanceSet id cloud.InstanceID tags cloud.InstanceTags + initCommand cloud.InitCommand providerType string SSHService SSHService running map[string]bool @@ -247,7 +251,7 @@ func (svm *StubVM) Exec(env map[string]string, command string, stdin io.Reader, svm.Unlock() time.Sleep(svm.CrunchRunDetachDelay) fmt.Fprintf(stderr, "starting %s\n", uuid) - logger := logrus.WithFields(logrus.Fields{ + logger := svm.sis.logger.WithFields(logrus.Fields{ "Instance": svm.id, "ContainerUUID": uuid, })