Skip to content

Commit

Permalink
fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
motoki317 committed Jul 29, 2020
1 parent 9266258 commit 4e618c8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions service/channel/manager_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (
"github.com/traPtitech/traQ/utils/random"
"github.com/traPtitech/traQ/utils/set"
"go.uber.org/zap"
"sort"
"strconv"
"strings"
"testing"
"time"
)
Expand Down Expand Up @@ -476,8 +478,8 @@ func TestManagerImpl_UpdateChannel(t *testing.T) {
},
},
}
for i, cc := range cases {
c := cc
for i, c := range cases {
c := c
t.Run(strconv.Itoa(i), func(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
Expand Down Expand Up @@ -555,6 +557,12 @@ func TestManagerImpl_UpdateChannel(t *testing.T) {
if assert.NoError(t, err) {
v, err := cm.GetChannel(c.ID)
require.NoError(t, err)
sort.Slice(v.ChildrenID, func(i, j int) bool {
return strings.Compare(v.ChildrenID[i].String(), v.ChildrenID[j].String()) > 0
})
sort.Slice(new.ChildrenID, func(i, j int) bool {
return strings.Compare(new.ChildrenID[i].String(), new.ChildrenID[j].String()) > 0
})
assert.EqualValues(t, &new, v)
}
})
Expand Down

0 comments on commit 4e618c8

Please sign in to comment.