Merge branch '16080-github' refs #16080
[arvados.git] / lib / cloud / cloudtest / tester.go
index e0a6a3597bd1a2bfaa6fe71db542d4027579a1eb..60938341798a100064e066ee8f78c686e2e953f5 100644 (file)
@@ -11,10 +11,10 @@ import (
        "fmt"
        "time"
 
-       "git.curoverse.com/arvados.git/lib/cloud"
-       "git.curoverse.com/arvados.git/lib/dispatchcloud/ssh_executor"
-       "git.curoverse.com/arvados.git/lib/dispatchcloud/worker"
-       "git.curoverse.com/arvados.git/sdk/go/arvados"
+       "git.arvados.org/arvados.git/lib/cloud"
+       "git.arvados.org/arvados.git/lib/dispatchcloud/ssh_executor"
+       "git.arvados.org/arvados.git/lib/dispatchcloud/worker"
+       "git.arvados.org/arvados.git/sdk/go/arvados"
        "github.com/sirupsen/logrus"
        "golang.org/x/crypto/ssh"
 )
@@ -69,17 +69,18 @@ func (t *tester) Run() bool {
                return false
        }
 
-       // Don't send the driver any filters the first time we get the
-       // instance list. This way we can log an instance count
-       // (N=...)  that includes all instances in this service
-       // account, even if they don't have the same InstanceSetID.
-       insts, err := t.getInstances(nil)
-       if err != nil {
-               t.Logger.WithError(err).Info("error getting initial list of instances")
-               return false
-       }
-
        for {
+               // Don't send the driver any filters when getting the
+               // initial instance list. This way we can log an
+               // instance count (N=...)  that includes all instances
+               // in this service account, even if they don't have
+               // the same InstanceSetID.
+               insts, err := t.getInstances(nil)
+               if err != nil {
+                       t.Logger.WithError(err).Info("error getting list of instances")
+                       return false
+               }
+
                foundExisting := false
                for _, i := range insts {
                        if i.Tags()[t.TagKeyPrefix+"InstanceSetID"] != string(t.SetID) {
@@ -342,15 +343,18 @@ func (t *tester) destroyTestInstance() bool {
                return true
        }
        for {
-               t.Logger.WithField("Instance", t.testInstance.ID()).Info("destroying instance")
+               lgr := t.Logger.WithField("Instance", t.testInstance.ID())
+               lgr.Info("destroying instance")
                t0 := time.Now()
+
                err := t.testInstance.Destroy()
-               lgr := t.Logger.WithField("Instance", t.testInstance.ID())
-               if lgr := lgr.WithField("Duration", time.Since(t0)); err != nil {
-                       lgr.WithError(err).Error("error destroying instance")
+               lgrDur := lgr.WithField("Duration", time.Since(t0))
+               if err != nil {
+                       lgrDur.WithError(err).Error("error destroying instance")
                } else {
-                       lgr.Info("destroyed instance")
+                       lgrDur.Info("destroyed instance")
                }
+
                err = t.refreshTestInstance()
                if err == errTestInstanceNotFound {
                        lgr.Info("instance no longer appears in list")