Skip to content

Commit

Permalink
make TestService_UserReplies more robust
Browse files Browse the repository at this point in the history
It flaps (see #380), and with this change it will
have more time to get the expected output in flaky
GitHub Actions environment.
  • Loading branch information
paskal committed Sep 4, 2021
1 parent 91441d1 commit 432e310
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions backend/app/store/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,10 +1057,12 @@ func TestService_UserReplies(t *testing.T) {
require.Equal(t, 3, len(cc), "3 replies to u1")
assert.Equal(t, "developer one u1", u)

cc, u, err = b.UserReplies("radio-t", "u1", 10, time.Millisecond*199)
assert.NoError(t, err)
require.Equal(t, 1, len(cc), "1 reply to u1 in last 200ms")
assert.Equal(t, "developer one u1", u)
assert.Eventuallyf(t, func() bool {
cc, u, err = b.UserReplies("radio-t", "u1", 10, time.Millisecond*199)
require.NoError(t, err)
require.Equal(t, "developer one u1", u)
return len(cc) == 1
}, time.Second, 100*time.Millisecond, "1 reply to u1")

cc, u, err = b.UserReplies("radio-t", "u2", 10, time.Hour)
assert.NoError(t, err)
Expand Down

0 comments on commit 432e310

Please sign in to comment.