From 76ce2a8ffccf1ef21f9b5dc09fb2481408960c18 Mon Sep 17 00:00:00 2001 From: aalu1418 <50029043+aalu1418@users.noreply.github.com> Date: Wed, 22 May 2024 18:40:20 -0600 Subject: [PATCH] parallelize e2e tests --- integration-tests/gauntlet/gauntlet_solana.go | 7 +++---- integration-tests/smoke/ocr2_test.go | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/integration-tests/gauntlet/gauntlet_solana.go b/integration-tests/gauntlet/gauntlet_solana.go index f7e088f10..ef3884fe2 100644 --- a/integration-tests/gauntlet/gauntlet_solana.go +++ b/integration-tests/gauntlet/gauntlet_solana.go @@ -65,7 +65,6 @@ type Transmission struct { // NewSolanaGauntlet Creates a default gauntlet config func NewSolanaGauntlet(workingDir string) (*SolanaGauntlet, error) { g, err := gauntlet.NewGauntlet() - g.SetWorkingDir(workingDir) if err != nil { return nil, err } @@ -117,11 +116,11 @@ func (sg *SolanaGauntlet) SetupNetwork(args map[string]string) error { func (sg *SolanaGauntlet) InstallDependencies() error { sg.G.Command = "yarn" - _, err := sg.G.ExecCommand([]string{"install"}, *sg.options) + _, err := sg.G.ExecCommand([]string{"--cwd", sg.Dir, "install"}, *sg.options) if err != nil { return err } - _, err = sg.G.ExecCommand([]string{"build"}, *sg.options) // initial build + _, err = sg.G.ExecCommand([]string{"--cwd", sg.Dir, "build"}, *sg.options) // initial build if err != nil { return err } @@ -131,7 +130,7 @@ func (sg *SolanaGauntlet) InstallDependencies() error { // exect is a custom wrapper to use custom set gauntlet command + error wrapping func (sg *SolanaGauntlet) exec(args []string, options gauntlet.ExecCommandOptions) (string, error) { - updatedArgs := []string{sg.G.Command, args[0], sg.G.Flag("network", sg.G.Network)} + updatedArgs := []string{"--cwd", sg.Dir, sg.G.Command, args[0], sg.G.Flag("network", sg.G.Network)} if len(args) > 1 { updatedArgs = append(updatedArgs, args[1:]...) } diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index 645efb4b2..77ca5d0fa 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -3,6 +3,7 @@ package smoke import ( "fmt" "maps" + "os/exec" "testing" "time" @@ -37,7 +38,10 @@ func TestSolanaOCRV2Smoke(t *testing.T) { test := test t.Run(test.name, func(t *testing.T) { - state, err := common.NewOCRv2State(t, 1, "gauntlet-"+test.name, &config) + t.Parallel() + + name := "gauntlet-" + test.name + state, err := common.NewOCRv2State(t, 1, name, &config) require.NoError(t, err, "Could not setup the ocrv2 state") if len(test.env) > 0 { state.Common.TestEnvDetails.NodeOpts = append(state.Common.TestEnvDetails.NodeOpts, func(n *test_env.ClNode) { @@ -50,7 +54,13 @@ func TestSolanaOCRV2Smoke(t *testing.T) { state.DeployCluster(utils.ContractsDir) - sg, err := gauntlet.NewSolanaGauntlet(fmt.Sprintf("%s/gauntlet", utils.ProjectRoot)) + // copy gauntlet folder to run in parallel (gauntlet generates an output file that is read by the e2e tests - causes conflict if shared) + gauntletCopyPath := utils.ProjectRoot + "/" + name + if out, cpErr := exec.Command("cp", "-r", utils.ProjectRoot+"/gauntlet", gauntletCopyPath).Output(); cpErr != nil { // nolint:gosec + require.NoError(t, err, "output: "+string(out)) + } + + sg, err := gauntlet.NewSolanaGauntlet(gauntletCopyPath) require.NoError(t, err) state.Gauntlet = sg