aboutsummaryrefslogtreecommitdiffstats
path: root/core/test/app_test.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2019-03-22 21:45:22 +0800
committerGitHub <noreply@github.com>2019-03-22 21:45:22 +0800
commitfb9bbdf2a34aa45c0f032b996f72cafd7bccfa80 (patch)
treec19d1204850e46145bebcb22703ebb718a5f1d7b /core/test/app_test.go
parent0f2dd4260fd98b2be06b7f9b0197134c89f11d3c (diff)
downloaddexon-consensus-fb9bbdf2a34aa45c0f032b996f72cafd7bccfa80.tar
dexon-consensus-fb9bbdf2a34aa45c0f032b996f72cafd7bccfa80.tar.gz
dexon-consensus-fb9bbdf2a34aa45c0f032b996f72cafd7bccfa80.tar.bz2
dexon-consensus-fb9bbdf2a34aa45c0f032b996f72cafd7bccfa80.tar.lz
dexon-consensus-fb9bbdf2a34aa45c0f032b996f72cafd7bccfa80.tar.xz
dexon-consensus-fb9bbdf2a34aa45c0f032b996f72cafd7bccfa80.tar.zst
dexon-consensus-fb9bbdf2a34aa45c0f032b996f72cafd7bccfa80.zip
core: remove initRoundBeginHeight paramenter
* Implement Governance.GetRoundHeight in test.Governance.
Diffstat (limited to 'core/test/app_test.go')
-rw-r--r--core/test/app_test.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/core/test/app_test.go b/core/test/app_test.go
index e06b758..0a68f5e 100644
--- a/core/test/app_test.go
+++ b/core/test/app_test.go
@@ -283,13 +283,19 @@ func (s *AppTestSuite) TestAttachedWithRoundEvent() {
// integraion.RoundEventTestSuite.TestFromRoundN, the difference is the
// calls to utils.RoundEvent.ValidateNextRound is not explicitly called but
// triggered by App.BlockDelivered.
- gov := s.prepareGov()
+ var (
+ gov = s.prepareGov()
+ roundLength = uint64(100)
+ )
s.Require().NoError(gov.State().RequestChange(StateChangeRoundLength,
- uint64(100)))
- gov.CatchUpWithRound(22)
+ roundLength))
for r := uint64(2); r <= uint64(20); r++ {
gov.ProposeCRS(r, getCRS(r, 0))
}
+ for r := uint64(0); r <= uint64(19); r++ {
+ gov.NotifyRound(r, r*roundLength)
+ }
+ gov.NotifyRound(20, 2200)
// Reset round#20 twice, then make it done DKG preparation.
gov.ResetDKG(getCRS(20, 1))
gov.ResetDKG(getCRS(20, 2))
@@ -306,7 +312,7 @@ func (s *AppTestSuite) TestAttachedWithRoundEvent() {
s.proposeFinalize(gov, 22, 0, 3)
// Prepare utils.RoundEvent, starts from round#19, reset(for round#20)#1.
rEvt, err := utils.NewRoundEvent(context.Background(), gov, s.logger, 19,
- 1900, 2019, core.ConfigRoundShift)
+ 2019, core.ConfigRoundShift)
s.Require().NoError(err)
// Register a handler to collects triggered events.
evts := make(chan evtParamToCheck, 3)
@@ -334,8 +340,10 @@ func (s *AppTestSuite) TestAttachedWithRoundEvent() {
}
}
// Deliver blocks from height=2020 to height=2081.
- deliver(0, 0, 2019)
- deliver(19, 2020, 2091)
+ for r := uint64(0); r <= uint64(19); r++ {
+ deliver(r, r*roundLength, (r+1)*roundLength-1)
+ }
+ deliver(19, 2000, 2091)
s.Require().Equal(<-evts, evtParamToCheck{19, 1, 2000, gov.CRS(19)})
s.Require().Equal(<-evts, evtParamToCheck{19, 2, 2100, gov.CRS(19)})
s.Require().Equal(<-evts, evtParamToCheck{20, 0, 2200, gov.CRS(20)})