Skip to content

Commit

Permalink
[processor/deltatocumulative]: fix TestLimitEvict
Browse files Browse the repository at this point in the history
due to undefined map iteration order, this test was flaky
  • Loading branch information
sh0rez committed May 29, 2024
1 parent 821c864 commit d525335
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 d525335

Please sign in to comment.