Skip to content

Commit

Permalink
Flaky: TestAllocatorAllocateOnGameServerUpdateError (#3300)
Browse files Browse the repository at this point in the history
Okay, I'm trying this one more time, with a slightly different take.
  • Loading branch information
markmandel committed Aug 1, 2023
1 parent ed9595c commit 19745be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/gameserverallocations/allocator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,10 @@ func TestAllocatorAllocateOnGameServerUpdateError(t *testing.T) {
defer cancel()

require.NoError(t, a.Run(ctx))
// wait for the single gameserver to be in the cache.
// wait for 4 gameservers in the cache
require.Eventuallyf(t, func() bool {
return a.allocationCache.cache.Len() >= 1
}, 10*time.Second, time.Second, "should have a single item in the cache")
return a.allocationCache.cache.Len() == 4
}, 10*time.Second, time.Second, "should be four items in the cache")

gsa := allocationv1.GameServerAllocation{ObjectMeta: metav1.ObjectMeta{Name: "gsa-1", Namespace: defaultNs},
Spec: allocationv1.GameServerAllocationSpec{},
Expand All @@ -497,10 +497,10 @@ func TestAllocatorAllocateOnGameServerUpdateError(t *testing.T) {
// make sure we aren't in the same batch!
time.Sleep(2 * a.batchWaitTime)

// triple check there is still a gameserver in the cache
// Make sure there are 4 still.
require.Eventuallyf(t, func() bool {
return a.allocationCache.cache.Len() >= 1
}, 10*time.Second, time.Second, "should have a single item in the cache (still)")
return a.allocationCache.cache.Len() == 4
}, 10*time.Second, time.Second, "should be four items in the cache")

// try the public method
result, err := a.Allocate(ctx, gsa.DeepCopy())
Expand Down

0 comments on commit 19745be

Please sign in to comment.