aboutsummaryrefslogtreecommitdiffstats
path: root/core/dkg-tsig-protocol_test.go
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-10-24 17:50:09 +0800
committerGitHub <noreply@github.com>2018-10-24 17:50:09 +0800
commitdbee0586b0a565ae9a31a3c2d967f5c2af76f60d (patch)
treecdfaef7754aedfda8d02c7023364a645e391e59e /core/dkg-tsig-protocol_test.go
parentf90c15fcfa575e138355a449c49cd784ba54db17 (diff)
downloaddexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.tar.gz
dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.tar.zst
dexon-consensus-dbee0586b0a565ae9a31a3c2d967f5c2af76f60d.zip
test: add test.State (#239)
* separate test utility and interface implementation for test.Governance. * add test.State. * integrate test.State to test.Governance. test.State is mainly used to emulate state propagation on fullnode.
Diffstat (limited to 'core/dkg-tsig-protocol_test.go')
-rw-r--r--core/dkg-tsig-protocol_test.go33
1 files changed, 25 insertions, 8 deletions
diff --git a/core/dkg-tsig-protocol_test.go b/core/dkg-tsig-protocol_test.go
index e533a2f..5c60a2f 100644
--- a/core/dkg-tsig-protocol_test.go
+++ b/core/dkg-tsig-protocol_test.go
@@ -139,7 +139,9 @@ func (s *DKGTSIGProtocolTestSuite) TestDKGTSIGProtocol() {
k := 2
n := 10
round := uint64(1)
- gov, err := test.NewGovernance(5, 100)
+ _, pubKeys, err := test.NewKeys(5)
+ s.Require().NoError(err)
+ gov, err := test.NewGovernance(pubKeys, 100)
s.Require().NoError(err)
receivers, protocols := s.newProtocols(k, n, round)
@@ -242,7 +244,9 @@ func (s *DKGTSIGProtocolTestSuite) TestNackComplaint() {
k := 3
n := 10
round := uint64(1)
- gov, err := test.NewGovernance(5, 100)
+ _, pubKeys, err := test.NewKeys(5)
+ s.Require().NoError(err)
+ gov, err := test.NewGovernance(pubKeys, 100)
s.Require().NoError(err)
receivers, protocols := s.newProtocols(k, n, round)
@@ -286,7 +290,9 @@ func (s *DKGTSIGProtocolTestSuite) TestComplaint() {
k := 3
n := 10
round := uint64(1)
- gov, err := test.NewGovernance(5, 100)
+ _, pubKeys, err := test.NewKeys(5)
+ s.Require().NoError(err)
+ gov, err := test.NewGovernance(pubKeys, 100)
s.Require().NoError(err)
receivers, protocols := s.newProtocols(k, n, round)
@@ -349,7 +355,9 @@ func (s *DKGTSIGProtocolTestSuite) TestAntiComplaint() {
k := 3
n := 10
round := uint64(1)
- gov, err := test.NewGovernance(5, 100)
+ _, pubKeys, err := test.NewKeys(5)
+ s.Require().NoError(err)
+ gov, err := test.NewGovernance(pubKeys, 100)
s.Require().NoError(err)
receivers, protocols := s.newProtocols(k, n, round)
@@ -404,7 +412,9 @@ func (s *DKGTSIGProtocolTestSuite) TestEncorceNackComplaint() {
k := 3
n := 10
round := uint64(1)
- gov, err := test.NewGovernance(5, 100)
+ _, pubKeys, err := test.NewKeys(5)
+ s.Require().NoError(err)
+ gov, err := test.NewGovernance(pubKeys, 100)
s.Require().NoError(err)
receivers, protocols := s.newProtocols(k, n, round)
@@ -456,7 +466,9 @@ func (s *DKGTSIGProtocolTestSuite) TestQualifyIDs() {
k := 3
n := 10
round := uint64(1)
- gov, err := test.NewGovernance(5, 100)
+ _, pubKeys, err := test.NewKeys(5)
+ s.Require().NoError(err)
+ gov, err := test.NewGovernance(pubKeys, 100)
s.Require().NoError(err)
receivers, _ := s.newProtocols(k, n, round)
@@ -519,7 +531,9 @@ func (s *DKGTSIGProtocolTestSuite) TestPartialSignature() {
k := 3
n := 10
round := uint64(1)
- gov, err := test.NewGovernance(5, 100)
+ _, pubKeys, err := test.NewKeys(5)
+ s.Require().NoError(err)
+ gov, err := test.NewGovernance(pubKeys, 100)
s.Require().NoError(err)
receivers, protocols := s.newProtocols(k, n, round)
@@ -639,8 +653,11 @@ func (s *DKGTSIGProtocolTestSuite) TestProposeFinalize() {
func (s *DKGTSIGProtocolTestSuite) TestTSigVerifierCache() {
k := 3
n := 10
- gov, err := test.NewGovernance(n, 100)
+ _, pubKeys, err := test.NewKeys(n)
+ s.Require().NoError(err)
+ gov, err := test.NewGovernance(pubKeys, 100)
s.Require().NoError(err)
+ gov.CatchUpWithRound(10)
for i := 0; i < 10; i++ {
round := uint64(i + 1)
receivers, protocols := s.newProtocols(k, n, round)