Skip to content

Commit

Permalink
fix: compare alloc IDs to avoid flaky tests when verifying no alloc w…
Browse files Browse the repository at this point in the history
…as stoped
  • Loading branch information
Juanadelacuesta committed Nov 13, 2024
1 parent a91726b commit 194d4e9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions e2e/scaling/scaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand All @@ -220,10 +225,6 @@ func (tc *ScalingE2ETest) TestScalingBasicWithSystemSchedule(f *framework.F) {
stopedAllocs, _, err := jobs.Allocations(jobID, false, nil)

Check failure on line 225 in e2e/scaling/scaling.go

View workflow job for this annotation

GitHub Actions / checks / checks

ineffectual assignment to stopedAllocs (ineffassign)
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)

Expand Down

0 comments on commit 194d4e9

Please sign in to comment.