Skip to content

Commit

Permalink
fix: flaky test: slice comparison to ignore element order (#661)
Browse files Browse the repository at this point in the history
Co-authored-by: Francesco Casula <[email protected]>
  • Loading branch information
lvrach and fracasula authored Sep 27, 2024
1 parent 96fb376 commit 545da59
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 545da59

Please sign in to comment.