Skip to content

Commit 3744d78

Browse files
committed
cleanup code
1 parent 160f4b6 commit 3744d78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/remote/instance.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (i *InstanceInfo) CreateOrGetInstance(imageURL, serviceAccount string) erro
146146
then := time.Now()
147147
err := wait.Poll(15*time.Second, 5*time.Minute, func() (bool, error) {
148148
klog.V(2).Infof("Waiting for instance to be deleted. %v elapsed", time.Since(then))
149-
if instance, _ = i.computeService.Instances.Get(i.project, i.zone, i.name).Do(); instance != nil {
149+
if curInst, _ = i.computeService.Instances.Get(i.project, i.zone, i.name).Do(); curInst != nil {
150150
return false, nil
151151
}
152152
return true, nil
@@ -157,7 +157,7 @@ func (i *InstanceInfo) CreateOrGetInstance(imageURL, serviceAccount string) erro
157157
}
158158
}
159159

160-
if _, err := i.computeService.Instances.Get(i.project, i.zone, newInst.Name).Do(); err != nil {
160+
if curInst == nil {
161161
op, err := i.computeService.Instances.Insert(i.project, i.zone, newInst).Do()
162162
klog.V(4).Infof("Inserted instance %v in project: %v, zone: %v", newInst.Name, i.project, i.zone)
163163
if err != nil {

0 commit comments

Comments
 (0)