diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-11-01 14:53:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-01 14:53:31 +0800 |
commit | ebfa4a6164dab7db29859538c1aa0e9659bd951a (patch) | |
tree | 317ee8ee45194ec63b4475565bf91cc7862494db /core/test/app_test.go | |
parent | 56fe2ee9435a89a46c0f3d527580aac43c85dc65 (diff) | |
download | dexon-consensus-ebfa4a6164dab7db29859538c1aa0e9659bd951a.tar dexon-consensus-ebfa4a6164dab7db29859538c1aa0e9659bd951a.tar.gz dexon-consensus-ebfa4a6164dab7db29859538c1aa0e9659bd951a.tar.bz2 dexon-consensus-ebfa4a6164dab7db29859538c1aa0e9659bd951a.tar.lz dexon-consensus-ebfa4a6164dab7db29859538c1aa0e9659bd951a.tar.xz dexon-consensus-ebfa4a6164dab7db29859538c1aa0e9659bd951a.tar.zst dexon-consensus-ebfa4a6164dab7db29859538c1aa0e9659bd951a.zip |
core: core.Lattice supports config change (#276)
Besides making core.Lattice supports config change,
This PR also include the first test for below scenario:
- Configuration changes are registered before test
running
- Those changes are carried/broadcasted as payload
of blocks
- Only one node would initiate these changes, however,
all nodes would finally receive/apply those changes
to their own test.Governance instance.
Diffstat (limited to 'core/test/app_test.go')
-rw-r--r-- | core/test/app_test.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/test/app_test.go b/core/test/app_test.go index 823bde0..933343f 100644 --- a/core/test/app_test.go +++ b/core/test/app_test.go @@ -91,12 +91,12 @@ func (s *AppTestSuite) deliverBlock( func (s *AppTestSuite) TestCompare() { req := s.Require() - app1 := NewApp() + app1 := NewApp(nil) s.setupAppByTotalOrderDeliver(app1, s.to1) s.setupAppByTotalOrderDeliver(app1, s.to2) s.setupAppByTotalOrderDeliver(app1, s.to3) // An App with different deliver sequence. - app2 := NewApp() + app2 := NewApp(nil) s.setupAppByTotalOrderDeliver(app2, s.to1) s.setupAppByTotalOrderDeliver(app2, s.to2) hash := common.NewRandomHash() @@ -105,7 +105,7 @@ func (s *AppTestSuite) TestCompare() { s.deliverBlockWithTimeFromSequenceLength(app2, hash) req.Equal(ErrMismatchBlockHashSequence, app1.Compare(app2)) // An App with different consensus time for the same block. - app3 := NewApp() + app3 := NewApp(nil) s.setupAppByTotalOrderDeliver(app3, s.to1) s.setupAppByTotalOrderDeliver(app3, s.to2) for _, h := range s.to3.BlockHashes { @@ -120,7 +120,7 @@ func (s *AppTestSuite) TestCompare() { req.Equal(ErrMismatchConsensusTime, app1.Compare(app3)) req.Equal(ErrMismatchConsensusTime, app3.Compare(app1)) // An App without any delivered blocks. - app4 := NewApp() + app4 := NewApp(nil) req.Equal(ErrEmptyDeliverSequence, app4.Compare(app1)) req.Equal(ErrEmptyDeliverSequence, app1.Compare(app4)) } @@ -129,7 +129,7 @@ func (s *AppTestSuite) TestVerify() { req := s.Require() // An OK App instance. - app1 := NewApp() + app1 := NewApp(nil) s.setupAppByTotalOrderDeliver(app1, s.to1) s.setupAppByTotalOrderDeliver(app1, s.to2) s.setupAppByTotalOrderDeliver(app1, s.to3) @@ -139,7 +139,7 @@ func (s *AppTestSuite) TestVerify() { uint64(len(app1.DeliverSequence))) req.Equal(ErrDeliveredBlockNotAcked, app1.Verify()) // The consensus time is out of order. - app2 := NewApp() + app2 := NewApp(nil) s.setupAppByTotalOrderDeliver(app2, s.to1) for _, h := range s.to2.BlockHashes { app2.StronglyAcked(h) @@ -149,14 +149,14 @@ func (s *AppTestSuite) TestVerify() { uint64(len(app2.DeliverSequence)+1)) req.Equal(ErrConsensusTimestampOutOfOrder, app2.Verify()) // A delivered block is not found in total ordering delivers. - app3 := NewApp() + app3 := NewApp(nil) s.setupAppByTotalOrderDeliver(app3, s.to1) hash := common.NewRandomHash() app3.StronglyAcked(hash) s.deliverBlockWithTimeFromSequenceLength(app3, hash) req.Equal(ErrMismatchTotalOrderingAndDelivered, app3.Verify()) // A delivered block is not found in total ordering delivers. - app4 := NewApp() + app4 := NewApp(nil) s.setupAppByTotalOrderDeliver(app4, s.to1) for _, h := range s.to2.BlockHashes { app4.StronglyAcked(h) @@ -167,10 +167,10 @@ func (s *AppTestSuite) TestVerify() { app4.TotalOrderingDelivered(common.Hashes{hash}, core.TotalOrderingModeNormal) s.deliverBlockWithTimeFromSequenceLength(app4, hash) // Witness ack on unknown block. - app5 := NewApp() + app5 := NewApp(nil) s.setupAppByTotalOrderDeliver(app5, s.to1) // The conensus height is out of order. - app6 := NewApp() + app6 := NewApp(nil) s.setupAppByTotalOrderDeliver(app6, s.to1) for _, h := range s.to2.BlockHashes { app6.StronglyAcked(h) |