Merge pull request #1125 from jaffee/test-api-compat

add MustRunMainWithCluster test func to have api compatibility with c…
This commit is contained in:
Matthew Jaffee 2018-02-20 12:06:55 -06:00 committed by GitHub
commit cd5dd9bfd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,6 +101,27 @@ func MustNewServerCluster(t *testing.T, size int) *Cluster {
return cluster
}
// **** below exists to have interface compatibility with cluster-resize,
// **** we can remove when cluster resize gets merged *****************//
type M struct {
*server.Command
Stdin bytes.Buffer
Stdout bytes.Buffer
Stderr bytes.Buffer
}
func MustRunMainWithCluster(t *testing.T, size int) []*M {
cluster := MustNewServerCluster(t, size)
mains := make([]*M, 0)
for _, s := range cluster.Servers {
mains = append(mains, &M{Command: s})
}
return mains
}
// ***********************************************************************************//
func NewServerCluster(size int) (cluster *Cluster, err error) {
cluster = &Cluster{
Servers: make([]*server.Command, size),