From 0071ec25bfa9f67b583f3fc8b49b5aadab40c348 Mon Sep 17 00:00:00 2001 From: corverroos Date: Fri, 27 May 2022 08:38:11 +0200 Subject: [PATCH] more --- .../compose/compose/smoke_internal_test.go | 29 ++++++++++++++++--- testutil/compose/compose_internal_test.go | 2 +- testutil/compose/config.go | 14 ++++----- testutil/compose/run.go | 14 ++++----- 4 files changed, 40 insertions(+), 19 deletions(-) diff --git a/testutil/compose/compose/smoke_internal_test.go b/testutil/compose/compose/smoke_internal_test.go index dfc57faf7..d06a4d2da 100644 --- a/testutil/compose/compose/smoke_internal_test.go +++ b/testutil/compose/compose/smoke_internal_test.go @@ -40,32 +40,41 @@ func TestSmoke(t *testing.T) { TmplFunc func(compose.TmplData) }{ { - Name: "create flow alpha", + Name: "default alpha", ConfigFunc: func(conf *compose.Config) { conf.KeyGen = compose.KeyGenCreate conf.FeatureSet = "alpha" }, }, { - Name: "create flow beta", + Name: "default beta", ConfigFunc: func(conf *compose.Config) { conf.KeyGen = compose.KeyGenCreate conf.FeatureSet = "beta" }, }, { - Name: "create flow stable", + Name: "default stable", ConfigFunc: func(conf *compose.Config) { conf.KeyGen = compose.KeyGenCreate conf.FeatureSet = "stable" }, }, { - Name: "dkg flow", + Name: "dkg", ConfigFunc: func(conf *compose.Config) { conf.KeyGen = compose.KeyGenDKG }, }, + { + Name: "very large dkg", + ConfigFunc: func(conf *compose.Config) { + conf.NumNodes = 21 + conf.Threshold = 14 + conf.NumValidators = 1000 + conf.KeyGen = compose.KeyGenDKG + }, + }, { Name: "version matrix", TmplFunc: func(data compose.TmplData) { @@ -75,6 +84,18 @@ func TestSmoke(t *testing.T) { data.Nodes[3].ImageTag = "v0.5.0" }, }, + { + Name: "teku versions", // TODO(corver): Do the same for lighthouse. + ConfigFunc: func(conf *compose.Config) { + conf.VCs = []compose.VCType{compose.VCTeku} + }, + TmplFunc: func(data compose.TmplData) { + data.VCs[0].Image = "consensys/teku:latest" + data.VCs[1].Image = "consensys/teku:22.5" + data.VCs[2].Image = "consensys/teku:22.4" + data.VCs[3].Image = "consensys/teku:22.3" + }, + }, } for _, test := range tests { diff --git a/testutil/compose/compose_internal_test.go b/testutil/compose/compose_internal_test.go index f72d85b1b..59f7e7096 100644 --- a/testutil/compose/compose_internal_test.go +++ b/testutil/compose/compose_internal_test.go @@ -110,6 +110,6 @@ func TestParseTemplate(t *testing.T) { _, err := template.New("").Parse(string(tmpl)) require.NoError(t, err) - _, err = getVC(vcTeku, 0, 1) + _, err = getVC(VCTeku, 0, 1) require.NoError(t, err) } diff --git a/testutil/compose/config.go b/testutil/compose/config.go index 6fc825dad..d9f1153a3 100644 --- a/testutil/compose/config.go +++ b/testutil/compose/config.go @@ -35,13 +35,13 @@ const ( cmdCreateDKG = "[create,dkg]" ) -// vcType defines a validator client type. -type vcType string +// VCType defines a validator client type. +type VCType string const ( - vcMock vcType = "mock" - vcTeku vcType = "teku" - vcLighthouse vcType = "lighthouse" + VCMock VCType = "mock" + VCTeku VCType = "teku" + VCLighthouse VCType = "lighthouse" ) // KeyGen defines a key generation process. @@ -94,7 +94,7 @@ type Config struct { BeaconNode string `json:"beacon_node"` // VCs define the types of validator clients to use. - VCs []vcType `json:"validator_clients"` + VCs []VCType `json:"validator_clients"` // FeatureSet defines the minimum feature set to enable. FeatureSet string `json:"feature_set"` @@ -117,7 +117,7 @@ func NewDefaultConfig() Config { Threshold: defaultThreshold, NumValidators: defaultNumVals, ImageTag: defaultImageTag, - VCs: []vcType{vcTeku, vcLighthouse, vcMock}, + VCs: []VCType{VCTeku, VCLighthouse, VCMock}, KeyGen: defaultKeyGen, BeaconNode: defaultBeaconNode, Step: stepNew, diff --git a/testutil/compose/run.go b/testutil/compose/run.go index ecdc11974..eb1a247aa 100644 --- a/testutil/compose/run.go +++ b/testutil/compose/run.go @@ -70,14 +70,14 @@ func Run(ctx context.Context, dir string, conf Config) (TmplData, error) { } // getVC returns the validator client template data for the provided type and index. -func getVC(typ vcType, nodeIdx int, numVals int) (vc, error) { - vcByType := map[vcType]vc{ - vcLighthouse: { - Label: string(vcLighthouse), +func getVC(typ VCType, nodeIdx int, numVals int) (vc, error) { + vcByType := map[VCType]vc{ + VCLighthouse: { + Label: string(VCLighthouse), Build: "lighthouse", }, - vcTeku: { - Label: string(vcTeku), + VCTeku: { + Label: string(VCTeku), Image: "consensys/teku:latest", Command: `| validator-client @@ -90,7 +90,7 @@ func getVC(typ vcType, nodeIdx int, numVals int) (vc, error) { } resp := vcByType[typ] - if typ == vcTeku { + if typ == VCTeku { var keys []string for i := 0; i < numVals; i++ { keys = append(keys, fmt.Sprintf("/compose/node%d/keystore-%d.json:/compose/node%d/keystore-%d.txt", nodeIdx, i, nodeIdx, i))