diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-12-06 14:30:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-06 14:30:05 +0800 |
commit | 41753e517c68575589c485b3f9570db94e59bcd0 (patch) | |
tree | 88ca8e57415164bce765658f3f55d51e85646eb3 /integration_test | |
parent | 4eb02f1dd96e136b0f7cf7eff792da1e44176713 (diff) | |
download | dexon-consensus-41753e517c68575589c485b3f9570db94e59bcd0.tar dexon-consensus-41753e517c68575589c485b3f9570db94e59bcd0.tar.gz dexon-consensus-41753e517c68575589c485b3f9570db94e59bcd0.tar.bz2 dexon-consensus-41753e517c68575589c485b3f9570db94e59bcd0.tar.lz dexon-consensus-41753e517c68575589c485b3f9570db94e59bcd0.tar.xz dexon-consensus-41753e517c68575589c485b3f9570db94e59bcd0.tar.zst dexon-consensus-41753e517c68575589c485b3f9570db94e59bcd0.zip |
test: allow to log in test.State (#359)
Diffstat (limited to 'integration_test')
-rw-r--r-- | integration_test/consensus_test.go | 12 | ||||
-rw-r--r-- | integration_test/stats_test.go | 5 | ||||
-rw-r--r-- | integration_test/with_scheduler_test.go | 9 |
3 files changed, 20 insertions, 6 deletions
diff --git a/integration_test/consensus_test.go b/integration_test/consensus_test.go index 5f22b1f..d66ff72 100644 --- a/integration_test/consensus_test.go +++ b/integration_test/consensus_test.go @@ -194,7 +194,9 @@ func (s *ConsensusTestSuite) TestSimple() { // Setup seed governance instance. Give a short latency to make this test // run faster. seedGov, err := test.NewGovernance( - pubKeys, 100*time.Millisecond, core.ConfigRoundShift) + test.NewState( + pubKeys, 100*time.Millisecond, &common.NullLogger{}, true), + core.ConfigRoundShift) req.NoError(err) req.NoError(seedGov.State().RequestChange( test.StateChangeRoundInterval, 50*time.Second)) @@ -237,7 +239,9 @@ func (s *ConsensusTestSuite) TestNumChainsChange() { req.NoError(err) // Setup seed governance instance. seedGov, err := test.NewGovernance( - pubKeys, 100*time.Millisecond, core.ConfigRoundShift) + test.NewState( + pubKeys, 100*time.Millisecond, &common.NullLogger{}, true), + core.ConfigRoundShift) req.NoError(err) // Setup configuration for round 0 and round 1. req.NoError(seedGov.State().RequestChange( @@ -311,7 +315,9 @@ func (s *ConsensusTestSuite) TestSync() { // Setup seed governance instance. Give a short latency to make this test // run faster. seedGov, err := test.NewGovernance( - pubKeys, 100*time.Millisecond, core.ConfigRoundShift) + test.NewState( + pubKeys, 100*time.Millisecond, &common.NullLogger{}, true), + core.ConfigRoundShift) req.NoError(err) req.NoError(seedGov.State().RequestChange( test.StateChangeRoundInterval, 30*time.Second)) diff --git a/integration_test/stats_test.go b/integration_test/stats_test.go index 5c1f412..95bd5ac 100644 --- a/integration_test/stats_test.go +++ b/integration_test/stats_test.go @@ -21,6 +21,7 @@ import ( "testing" "time" + "github.com/dexon-foundation/dexon-consensus/common" "github.com/dexon-foundation/dexon-consensus/core" "github.com/dexon-foundation/dexon-consensus/core/test" "github.com/stretchr/testify/suite" @@ -41,7 +42,9 @@ func (s *EventStatsTestSuite) TestCalculate() { prvKeys, pubKeys, err := test.NewKeys(7) req.NoError(err) gov, err := test.NewGovernance( - pubKeys, 100*time.Millisecond, core.ConfigRoundShift) + test.NewState( + pubKeys, 100*time.Millisecond, &common.NullLogger{}, true), + core.ConfigRoundShift) req.NoError(err) nodes, err := PrepareNodes( gov, prvKeys, 7, networkLatency, proposingLatency) diff --git a/integration_test/with_scheduler_test.go b/integration_test/with_scheduler_test.go index 6a94f01..66fc9b8 100644 --- a/integration_test/with_scheduler_test.go +++ b/integration_test/with_scheduler_test.go @@ -21,6 +21,7 @@ import ( "testing" "time" + "github.com/dexon-foundation/dexon-consensus/common" "github.com/dexon-foundation/dexon-consensus/core" "github.com/dexon-foundation/dexon-consensus/core/test" "github.com/stretchr/testify/suite" @@ -51,7 +52,9 @@ func (s *WithSchedulerTestSuite) TestNonByzantine() { req.NoError(err) // Setup governance. gov, err := test.NewGovernance( - pubKeys, 250*time.Millisecond, core.ConfigRoundShift) + test.NewState( + pubKeys, 250*time.Millisecond, &common.NullLogger{}, true), + core.ConfigRoundShift) req.NoError(err) // Setup nodes. nodes, err := PrepareNodes( @@ -92,7 +95,9 @@ func (s *WithSchedulerTestSuite) TestConfigurationChange() { req.NoError(err) // Setup governance. gov, err := test.NewGovernance( - pubKeys, 250*time.Millisecond, core.ConfigRoundShift) + test.NewState( + pubKeys, 250*time.Millisecond, &common.NullLogger{}, true), + core.ConfigRoundShift) req.NoError(err) // Change default round interval, expect 1 round produce 30 blocks. gov.State().RequestChange(test.StateChangeRoundInterval, 15*time.Second) |