Skip to content

Commit

Permalink
parallelize e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aalu1418 committed May 23, 2024
1 parent 431889b commit 76ce2a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
7 changes: 3 additions & 4 deletions integration-tests/gauntlet/gauntlet_solana.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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:]...)
}
Expand Down
14 changes: 12 additions & 2 deletions integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package smoke
import (
"fmt"
"maps"
"os/exec"
"testing"
"time"

Expand Down Expand Up @@ -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) {
Expand All @@ -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

Expand Down

0 comments on commit 76ce2a8

Please sign in to comment.