Merge pull request #28 from getamis/fix/add-force-stop-blockchain

container: add force stop blockchain
This commit is contained in:
yutelin 2017-08-22 11:40:30 +08:00 committed by GitHub
commit d41faf19da
4 changed files with 6 additions and 6 deletions

View File

@ -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
}
}

View File

@ -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)
}

View File

@ -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()
})

View File

@ -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()
})