Skip to content

Commit

Permalink
[processor/deltatocumulative]: fix TestLimitEvict (#33266)
Browse files Browse the repository at this point in the history
due to undefined map iteration order, this test was flaky

Fixes #33094

Co-authored-by: Juraci Paixão Kröhling <[email protected]>
Co-authored-by: Alex Boten <[email protected]>
  • Loading branch information
3 people authored May 31, 2024
1 parent 5427c93 commit 88eba8f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,18 @@ func TestLimitEvict(t *testing.T) {

items := make(exp.HashMap[data.Number])
lim := streams.Limit(items, 5)

ids := make([]identity.Stream, 10)
lim.Evictor = streams.EvictorFunc(func() (identity.Stream, bool) {
for id := range evictable {
delete(evictable, id)
return id, true
for _, id := range ids {
if _, ok := evictable[id]; ok {
delete(evictable, id)
return id, true
}
}
return identity.Stream{}, false
})

ids := make([]identity.Stream, 10)
dps := make([]data.Number, 10)
for i := 0; i < 10; i++ {
id, dp := sum.Stream()
Expand Down

0 comments on commit 88eba8f

Please sign in to comment.