Skip to content

Commit d3e5056

Browse files
committed
Gossip pullStore test fixes
1) Saw some sporadic failures of timeout in people's build jobs. I think 10s sometimes doesn't cut it in CI. Increased to 20s. If I'll see more failures after that I'll look deeper. 2) The assertions in TestHandleMessage might run twice before the test is finished and the second time they shouldn't be tested (because replication has been finished). Added a check for that. Change-Id: I319106dafad242063857acab2d502a6a14689324 Signed-off-by: Yacov Manevich <[email protected]>
1 parent bc1d8ae commit d3e5056

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

gossip/gossip/pull/pullstore_test.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
)
3232

3333
var pullInterval time.Duration
34-
var timeoutInterval = 10 * time.Second
34+
var timeoutInterval = 20 * time.Second
3535

3636
func init() {
3737
pullInterval = time.Duration(500) * time.Millisecond
@@ -222,11 +222,17 @@ func TestHandleMessage(t *testing.T) {
222222
inst1ReceivedResponse := int32(0)
223223

224224
inst1.mediator.RegisterMsgHook(DigestMsgType, func(itemIds []string, _ []*proto.GossipMessage, _ comm.ReceivedMessage) {
225+
if atomic.LoadInt32(&inst1ReceivedDigest) == int32(1) {
226+
return
227+
}
225228
atomic.StoreInt32(&inst1ReceivedDigest, int32(1))
226229
assert.True(t, len(itemIds) == 3)
227230
})
228231

229232
inst1.mediator.RegisterMsgHook(ResponseMsgType, func(_ []string, items []*proto.GossipMessage, _ comm.ReceivedMessage) {
233+
if atomic.LoadInt32(&inst1ReceivedResponse) == int32(1) {
234+
return
235+
}
230236
atomic.StoreInt32(&inst1ReceivedResponse, int32(1))
231237
assert.True(t, len(items) == 3)
232238
})

0 commit comments

Comments
 (0)