Skip to content

Commit 88eba8f

Browse files
tombrkjpkrohlingcodeboten
authored
[processor/deltatocumulative]: fix TestLimitEvict (#33266)
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]>
1 parent 5427c93 commit 88eba8f

File tree

1 file changed

+7
-4
lines changed
  • processor/deltatocumulativeprocessor/internal/streams

1 file changed

+7
-4
lines changed

processor/deltatocumulativeprocessor/internal/streams/limit_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,18 @@ func TestLimitEvict(t *testing.T) {
6464

6565
items := make(exp.HashMap[data.Number])
6666
lim := streams.Limit(items, 5)
67+
68+
ids := make([]identity.Stream, 10)
6769
lim.Evictor = streams.EvictorFunc(func() (identity.Stream, bool) {
68-
for id := range evictable {
69-
delete(evictable, id)
70-
return id, true
70+
for _, id := range ids {
71+
if _, ok := evictable[id]; ok {
72+
delete(evictable, id)
73+
return id, true
74+
}
7175
}
7276
return identity.Stream{}, false
7377
})
7478

75-
ids := make([]identity.Stream, 10)
7679
dps := make([]data.Number, 10)
7780
for i := 0; i < 10; i++ {
7881
id, dp := sum.Stream()

0 commit comments

Comments
 (0)