Merge pull request #28 from getamis/fix/add-force-stop-blockchain
container: add force stop blockchain
This commit is contained in:
commit
d41faf19da
|
@ -32,7 +32,7 @@ import (
|
|||
|
||||
type Blockchain interface {
|
||||
Start() error
|
||||
Stop() error
|
||||
Stop(bool) error
|
||||
Validators() []Ethereum
|
||||
Finalize()
|
||||
}
|
||||
|
@ -71,9 +71,9 @@ func (bc *blockchain) Start() error {
|
|||
return bc.connectAll()
|
||||
}
|
||||
|
||||
func (bc *blockchain) Stop() error {
|
||||
func (bc *blockchain) Stop(force bool) error {
|
||||
for _, v := range bc.validators {
|
||||
if err := v.Stop(); err != nil {
|
||||
if err := v.Stop(); err != nil && !force {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ func TestEthereumBlockchain(t *testing.T) {
|
|||
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
err = chain.Stop()
|
||||
err = chain.Stop(false)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ var _ = Describe("4 validators Istanbul", func() {
|
|||
})
|
||||
|
||||
AfterEach(func() {
|
||||
Expect(blockchain.Stop()).To(BeNil())
|
||||
Expect(blockchain.Stop(false)).To(BeNil())
|
||||
blockchain.Finalize()
|
||||
})
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ var _ = Describe("TSU-04: Non-Byzantine Faulty", func() {
|
|||
})
|
||||
|
||||
AfterEach(func() {
|
||||
blockchain.Stop() // This will return container not found error since we stop one
|
||||
blockchain.Stop(true) // This will return container not found error since we stop one
|
||||
blockchain.Finalize()
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue