From 82592adf64d141cbc73048a9151a20c6a7905849 Mon Sep 17 00:00:00 2001 From: Matthew Jaffee Date: Tue, 20 Feb 2018 11:50:06 -0600 Subject: [PATCH] add MustRunMainWithCluster test func to have api compatibility with cluster resize this will allow some pdk code which only works with cluster-resize to work against master (i think) --- test/pilosa.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/pilosa.go b/test/pilosa.go index e14b2d032..97c4321c9 100644 --- a/test/pilosa.go +++ b/test/pilosa.go @@ -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),