container, tests/*: add NodeIncubator interface
This commit is contained in:
parent
7f1b6f0c89
commit
f44fb93a4d
|
@ -44,6 +44,10 @@ const (
|
||||||
defaultPassword = ""
|
defaultPassword = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type NodeIncubator interface {
|
||||||
|
CreateNodes(int, ...Option) ([]Ethereum, error)
|
||||||
|
}
|
||||||
|
|
||||||
type Blockchain interface {
|
type Blockchain interface {
|
||||||
AddValidators(numOfValidators int) ([]Ethereum, error)
|
AddValidators(numOfValidators int) ([]Ethereum, error)
|
||||||
RemoveValidators(candidates []Ethereum, t time.Duration) error
|
RemoveValidators(candidates []Ethereum, t time.Duration) error
|
||||||
|
@ -52,7 +56,6 @@ type Blockchain interface {
|
||||||
Stop(bool) error
|
Stop(bool) error
|
||||||
Validators() []Ethereum
|
Validators() []Ethereum
|
||||||
Finalize()
|
Finalize()
|
||||||
CreateNodes(int, ...Option) ([]Ethereum, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBlockchain(network *DockerNetwork, numOfValidators int, options ...Option) (bc *blockchain) {
|
func NewBlockchain(network *DockerNetwork, numOfValidators int, options ...Option) (bc *blockchain) {
|
||||||
|
|
|
@ -52,7 +52,11 @@ var _ = Describe("Block synchronization testing", func() {
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
var err error
|
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.ImageRepository("quay.io/amis/geth"),
|
||||||
container.ImageTag("istanbul_develop"),
|
container.ImageTag("istanbul_develop"),
|
||||||
container.DataDir("/data"),
|
container.DataDir("/data"),
|
||||||
|
|
|
@ -57,7 +57,11 @@ var _ = Describe("Block synchronization testing", func() {
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
var err error
|
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.ImageRepository("quay.io/amis/geth"),
|
||||||
container.ImageTag("istanbul_develop"),
|
container.ImageTag("istanbul_develop"),
|
||||||
container.DataDir("/data"),
|
container.DataDir("/data"),
|
||||||
|
|
Loading…
Reference in New Issue