@@ -80,10 +80,10 @@ func TestRunNominateCandidate(t *testing.T) {
8080 }
8181 // 1. 构造term存储
8282 l , _ := cCtx .Ledger .(* kmock.FakeLedger )
83- l .Put (kmock .NewBlock (3 ))
84- l .Put (kmock .NewBlock (4 ))
85- l .Put (kmock .NewBlock (5 ))
86- l .Put (kmock .NewBlock (6 ))
83+ _ = l .Put (kmock .NewBlock (3 ))
84+ _ = l .Put (kmock .NewBlock (4 ))
85+ _ = l .Put (kmock .NewBlock (5 ))
86+ _ = l .Put (kmock .NewBlock (6 ))
8787 // 2. 整理Block的共识存储
8888 l .SetConsensusStorage (1 , SetTdposStorage (1 , nil ))
8989 l .SetConsensusStorage (2 , SetTdposStorage (1 , nil ))
@@ -116,10 +116,10 @@ func TestRunRevokeCandidate(t *testing.T) {
116116 }
117117 // 1. 构造term存储
118118 l , _ := cCtx .Ledger .(* kmock.FakeLedger )
119- l .Put (kmock .NewBlock (3 ))
120- l .Put (kmock .NewBlock (4 ))
121- l .Put (kmock .NewBlock (5 ))
122- l .Put (kmock .NewBlock (6 ))
119+ _ = l .Put (kmock .NewBlock (3 ))
120+ _ = l .Put (kmock .NewBlock (4 ))
121+ _ = l .Put (kmock .NewBlock (5 ))
122+ _ = l .Put (kmock .NewBlock (6 ))
123123 // 2. 整理Block的共识存储
124124 l .SetConsensusStorage (1 , SetTdposStorage (1 , nil ))
125125 l .SetConsensusStorage (2 , SetTdposStorage (1 , nil ))
@@ -137,7 +137,9 @@ func TestRunRevokeCandidate(t *testing.T) {
137137 i := NewTdposConsensus (* cCtx , getConfig (getTdposConsensusConf ()))
138138 tdpos , _ := i .(* tdposConsensus )
139139 fakeCtx := mock .NewFakeKContext (NewRevokeNominateArgs (), NewM ())
140- tdpos .runRevokeCandidate (fakeCtx )
140+ if _ , err := tdpos .runRevokeCandidate (fakeCtx ); err != nil {
141+ t .Fatal (err )
142+ }
141143}
142144
143145func TestRunVote (t * testing.T ) {
@@ -148,10 +150,10 @@ func TestRunVote(t *testing.T) {
148150 }
149151 // 1. 构造term存储
150152 l , _ := cCtx .Ledger .(* kmock.FakeLedger )
151- l .Put (kmock .NewBlock (3 ))
152- l .Put (kmock .NewBlock (4 ))
153- l .Put (kmock .NewBlock (5 ))
154- l .Put (kmock .NewBlock (6 ))
153+ _ = l .Put (kmock .NewBlock (3 ))
154+ _ = l .Put (kmock .NewBlock (4 ))
155+ _ = l .Put (kmock .NewBlock (5 ))
156+ _ = l .Put (kmock .NewBlock (6 ))
155157 // 2. 整理Block的共识存储
156158 l .SetConsensusStorage (1 , SetTdposStorage (1 , nil ))
157159 l .SetConsensusStorage (2 , SetTdposStorage (1 , nil ))
@@ -169,7 +171,10 @@ func TestRunVote(t *testing.T) {
169171 i := NewTdposConsensus (* cCtx , getConfig (getTdposConsensusConf ()))
170172 tdpos , _ := i .(* tdposConsensus )
171173 fakeCtx := mock .NewFakeKContext (NewVoteArgs (), NewM ())
172- tdpos .runVote (fakeCtx )
174+ _ , err = tdpos .runVote (fakeCtx )
175+ if err != nil {
176+ t .Fatal (err )
177+ }
173178}
174179func TestRunRevokeVote (t * testing.T ) {
175180 cCtx , err := prepare (getTdposConsensusConf ())
@@ -178,11 +183,11 @@ func TestRunRevokeVote(t *testing.T) {
178183 return
179184 }
180185 // 1. 构造term存储
181- l , _ := cCtx .Ledger .(* kmock.FakeLedger )
182- l .Put (kmock .NewBlock (3 ))
183- l .Put (kmock .NewBlock (4 ))
184- l .Put (kmock .NewBlock (5 ))
185- l .Put (kmock .NewBlock (6 ))
186+ l := cCtx .Ledger .(* kmock.FakeLedger )
187+ _ = l .Put (kmock .NewBlock (3 ))
188+ _ = l .Put (kmock .NewBlock (4 ))
189+ _ = l .Put (kmock .NewBlock (5 ))
190+ _ = l .Put (kmock .NewBlock (6 ))
186191 // 2. 整理Block的共识存储
187192 l .SetConsensusStorage (1 , SetTdposStorage (1 , nil ))
188193 l .SetConsensusStorage (2 , SetTdposStorage (1 , nil ))
@@ -200,5 +205,7 @@ func TestRunRevokeVote(t *testing.T) {
200205 i := NewTdposConsensus (* cCtx , getConfig (getTdposConsensusConf ()))
201206 tdpos , _ := i .(* tdposConsensus )
202207 fakeCtx := mock .NewFakeKContext (NewNominateArgs (), NewM ())
203- tdpos .runRevokeVote (fakeCtx )
208+ if _ , err := tdpos .runRevokeVote (fakeCtx ); err != nil {
209+ t .Fatal (err )
210+ }
204211}
0 commit comments