Skip to content

Commit

Permalink
Gossip pullStore test fixes
Browse files Browse the repository at this point in the history
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 <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Dec 17, 2016
1 parent bc1d8ae commit d3e5056
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gossip/gossip/pull/pullstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
)

var pullInterval time.Duration
var timeoutInterval = 10 * time.Second
var timeoutInterval = 20 * time.Second

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

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

inst1.mediator.RegisterMsgHook(ResponseMsgType, func(_ []string, items []*proto.GossipMessage, _ comm.ReceivedMessage) {
if atomic.LoadInt32(&inst1ReceivedResponse) == int32(1) {
return
}
atomic.StoreInt32(&inst1ReceivedResponse, int32(1))
assert.True(t, len(items) == 3)
})
Expand Down

0 comments on commit d3e5056

Please sign in to comment.