From 95dc174b97dfb23dc68ebc07c95bfd73affae451 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Thu, 7 Feb 2019 17:15:43 +0400 Subject: [PATCH] fix merge conflicts --- consensus/common_test.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/consensus/common_test.go b/consensus/common_test.go index 5b7c9772..0c4388f0 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -368,8 +368,23 @@ func ensureNewEvent(ch <-chan tmpubsub.Message, height int64, round int, timeout } } -func ensureNewRoundStep(stepCh <-chan tmpubsub.Message, height int64, round int) { - ensureNewEvent(stepCh, height, round, ensureTimeout, "Timeout expired while waiting for NewStep event") +func ensureNewRound(roundCh <-chan tmpubsub.Message, height int64, round int) { + select { + case <-time.After(ensureTimeout): + panic("Timeout expired while waiting for NewRound event") + case msg := <-roundCh: + newRoundEvent, ok := msg.Data().(types.EventDataNewRound) + if !ok { + panic(fmt.Sprintf("expected a EventDataNewRound, got %T. Wrong subscription channel?", + msg.Data())) + } + if newRoundEvent.Height != height { + panic(fmt.Sprintf("expected height %v, got %v", height, newRoundEvent.Height)) + } + if newRoundEvent.Round != round { + panic(fmt.Sprintf("expected round %v, got %v", round, newRoundEvent.Round)) + } + } } func ensureNewTimeout(timeoutCh <-chan tmpubsub.Message, height int64, round int, timeout int64) {