From 194d4e91ccabfaf045c9dcac09c17e3ca6ccca68 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:05:38 +0100 Subject: [PATCH] fix: compare alloc IDs to avoid flaky tests when verifying no alloc was stoped --- e2e/scaling/scaling.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/e2e/scaling/scaling.go b/e2e/scaling/scaling.go index 6570f8c573f..dd3260fff4e 100644 --- a/e2e/scaling/scaling.go +++ b/e2e/scaling/scaling.go @@ -207,7 +207,12 @@ func (tc *ScalingE2ETest) TestScalingBasicWithSystemSchedule(f *framework.F) { jobs = nomadClient.Jobs() allocs1, _, err := jobs.Allocations(jobID, true, nil) f.NoError(err) - f.EqualValues(initialAllocs, allocs1) + + f.Equal(len(initialAllocs), len(allocs1)) + + for i, a := range allocs1 { + f.Equal(a.ID, initialAllocs[i].ID) + } // Scale down to 0 testMeta = map[string]interface{}{"scaling-e2e-test": "value"} @@ -220,10 +225,6 @@ func (tc *ScalingE2ETest) TestScalingBasicWithSystemSchedule(f *framework.F) { stopedAllocs, _, err := jobs.Allocations(jobID, false, nil) f.NoError(err) - for _, alloc := range stopedAllocs { - e2eutil.WaitForAllocStatus(t, nomadClient, alloc.ID, structs.AllocClientStatusComplete) - } - stopedAllocs, _, err = jobs.Allocations(jobID, false, nil) f.NoError(err)