21258: Fix flaky boot_outcomes metric test.
authorTom Clegg <tom@curii.com>
Wed, 6 Dec 2023 15:22:24 +0000 (10:22 -0500)
committerTom Clegg <tom@curii.com>
Wed, 6 Dec 2023 15:22:24 +0000 (10:22 -0500)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/dispatchcloud/dispatcher_test.go

index 33d7f4e9acd2e5e15293faffefd4d2667e2899f7..e2f0db1efb5df6602ab37ceab3fa473f6a940d65 100644 (file)
@@ -208,7 +208,7 @@ func (s *DispatcherSuite) TestDispatchToStubDriver(c *check.C) {
                return int(rand.Uint32() & 0x3)
        }
        var countCapacityErrors int64
-       n := 0
+       vmCount := int32(0)
        s.stubDriver.Queue = queue
        s.stubDriver.SetupVM = func(stubvm *test.StubVM) error {
                if pt := stubvm.Instance().ProviderType(); pt == test.InstanceType(6).ProviderType {
@@ -216,7 +216,7 @@ func (s *DispatcherSuite) TestDispatchToStubDriver(c *check.C) {
                        atomic.AddInt64(&countCapacityErrors, 1)
                        return test.CapacityError{InstanceTypeSpecific: true}
                }
-               n++
+               n := atomic.AddInt32(&vmCount, 1)
                stubvm.Boot = time.Now().Add(time.Duration(rand.Int63n(int64(5 * time.Millisecond))))
                stubvm.CrunchRunDetachDelay = time.Duration(rand.Int63n(int64(10 * time.Millisecond)))
                stubvm.ExecuteContainer = executeContainer