Skip to content

Commit

Permalink
Fix flaky TestGetStatuses by sorting slices before comparing them
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyom authored and tekton-robot committed Jul 12, 2019
1 parent 4873422 commit e197459
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/pullrequest-init/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/google/go-cmp/cmp/cmpopts"
"net/http/httptest"
"net/url"
"os"
Expand Down Expand Up @@ -597,7 +598,7 @@ func TestGetStatuses(t *testing.T) {
if err != nil {
t.Fatalf("getStatuses: %v", err)
}
if diff := cmp.Diff(tc.want, s); diff != "" {
if diff := cmp.Diff(tc.want, s, cmpopts.SortSlices(func(x, y *Status) bool { return x.ID < y.ID })); diff != "" {
t.Errorf("-want +got: %s", diff)
}
})
Expand Down

0 comments on commit e197459

Please sign in to comment.