tests: reduce validator network size to less than 2F+1
This commit is contained in:
parent
2a39a56650
commit
63ec085509
|
@ -149,4 +149,36 @@ var _ = Describe("Dynamic validators addition/removal testing", func() {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
It("TFS-02-05 Reduce validator network size below 2F+1", func() {
|
||||
By("Ensure that blocks are generated by validators", func() {
|
||||
waitFor(blockchain.Validators(), func(geth container.Ethereum, wg *sync.WaitGroup) {
|
||||
Expect(geth.WaitForBlocks(5)).To(BeNil())
|
||||
wg.Done()
|
||||
})
|
||||
})
|
||||
|
||||
By("Reduce validator network size to less than 2F+1", func() {
|
||||
stopCandidates := blockchain.Validators()[numberOfValidators-2:]
|
||||
// stop validators [3,4]
|
||||
for _, candidates := range stopCandidates {
|
||||
c := candidates.NewIstanbulClient()
|
||||
Expect(c.StopMining(context.Background())).Should(BeNil())
|
||||
}
|
||||
})
|
||||
|
||||
By("Verify number of validators", func() {
|
||||
for _, v := range blockchain.Validators() {
|
||||
client := v.NewIstanbulClient()
|
||||
validators, err := client.GetValidators(context.Background(), nil)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(len(validators)).Should(BeNumerically("==", numberOfValidators))
|
||||
}
|
||||
})
|
||||
|
||||
By("No block generated", func() {
|
||||
// REMARK: ErrNoBlock will return if validators not generate block after 10 second.
|
||||
Expect(blockchain.EnsureConsensusWorking(blockchain.Validators(), 11*time.Second)).Should(Equal(container.ErrNoBlock))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue