Skip to content

Commit

Permalink
fix: flaky test: slice comparison to ignore element order
Browse files Browse the repository at this point in the history
  • Loading branch information
lvrach committed Sep 26, 2024
1 parent 8ac166b commit 163408d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stats/statsd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"net"
"reflect"
"sort"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -421,6 +422,10 @@ func TestStatsdRegisterCollector(t *testing.T) {
if len(received) != len(expected) {
return false
}

sort.Strings(received)
sort.Strings(expected)

return reflect.DeepEqual(received, expected)
}, 10*time.Second, time.Millisecond)
}
Expand Down

0 comments on commit 163408d

Please sign in to comment.