container, tests/*: add NodeIncubator interface

This commit is contained in:
Alan Chen 2017-09-12 14:45:10 +08:00
parent 7f1b6f0c89
commit f44fb93a4d
3 changed files with 14 additions and 3 deletions

View File

@ -44,6 +44,10 @@ const (
defaultPassword = ""
)
type NodeIncubator interface {
CreateNodes(int, ...Option) ([]Ethereum, error)
}
type Blockchain interface {
AddValidators(numOfValidators int) ([]Ethereum, error)
RemoveValidators(candidates []Ethereum, t time.Duration) error
@ -52,7 +56,6 @@ type Blockchain interface {
Stop(bool) error
Validators() []Ethereum
Finalize()
CreateNodes(int, ...Option) ([]Ethereum, error)
}
func NewBlockchain(network *DockerNetwork, numOfValidators int, options ...Option) (bc *blockchain) {

View File

@ -52,7 +52,11 @@ var _ = Describe("Block synchronization testing", func() {
BeforeEach(func() {
var err error
nodes, err = blockchain.CreateNodes(numberOfNodes,
incubator, ok := blockchain.(container.NodeIncubator)
Expect(ok).To(BeTrue())
nodes, err = incubator.CreateNodes(numberOfNodes,
container.ImageRepository("quay.io/amis/geth"),
container.ImageTag("istanbul_develop"),
container.DataDir("/data"),

View File

@ -57,7 +57,11 @@ var _ = Describe("Block synchronization testing", func() {
BeforeEach(func() {
var err error
nodes, err = blockchain.CreateNodes(numberOfNodes,
incubator, ok := blockchain.(container.NodeIncubator)
Expect(ok).To(BeTrue())
nodes, err = incubator.CreateNodes(numberOfNodes,
container.ImageRepository("quay.io/amis/geth"),
container.ImageTag("istanbul_develop"),
container.DataDir("/data"),