16723: Use more readable instance IDs in tests.
authorTom Clegg <tom@tomclegg.ca>
Fri, 21 Aug 2020 13:24:02 +0000 (09:24 -0400)
committerTom Clegg <tom@tomclegg.ca>
Fri, 21 Aug 2020 13:38:26 +0000 (09:38 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@tomclegg.ca>

lib/dispatchcloud/test/stub_driver.go

index 7a1f42301684a5a042f555c3e17ccda5d2f8b6c5..3e2f8efe0133ec16783ee91f2e2d6c0cd085d2f5 100644 (file)
@@ -99,6 +99,7 @@ type StubInstanceSet struct {
 
        allowCreateCall    time.Time
        allowInstancesCall time.Time
+       lastInstanceID     int
 }
 
 func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID, tags cloud.InstanceTags, cmd cloud.InitCommand, authKey ssh.PublicKey) (cloud.Instance, error) {
@@ -120,9 +121,10 @@ func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID,
        if authKey != nil {
                ak = append([]ssh.PublicKey{authKey}, ak...)
        }
+       sis.lastInstanceID++
        svm := &StubVM{
                sis:          sis,
-               id:           cloud.InstanceID(fmt.Sprintf("stub-%s-%x", it.ProviderType, math_rand.Int63())),
+               id:           cloud.InstanceID(fmt.Sprintf("inst%d,%s", sis.lastInstanceID, it.ProviderType)),
                tags:         copyTags(tags),
                providerType: it.ProviderType,
                initCommand:  cmd,