Skip to content

Commit

Permalink
Simplify remote runner by moving logic to beginning of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tateexon committed Jul 24, 2023
1 parent b31d72f commit 9b0e20e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
26 changes: 17 additions & 9 deletions integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package smoke
import (
"context"
"fmt"
"sort"
"testing"
"time"

"github.com/gagliardetto/solana-go/rpc"
"github.com/gagliardetto/solana-go/rpc/ws"
"github.com/lib/pq"
Expand All @@ -17,9 +21,6 @@ import (
"github.com/stretchr/testify/assert"
"go.uber.org/zap/zapcore"
"gopkg.in/guregu/null.v4"
"sort"
"testing"
"time"

"github.com/smartcontractkit/chainlink-solana/integration-tests/utils"

Expand All @@ -30,10 +31,13 @@ import (
func TestSolanaOCRV2Smoke(t *testing.T) {
l := ctfUtils.GetTestLogger(t)
state := common.NewOCRv2State(t, 1, "smoke", "localnet")
state.DeployCluster(utils.ContractsDir)
if state.Common.Env.WillUseRemoteRunner() {
// run the remote runner and exit
err := state.Common.Env.Run()
require.NoError(t, err)
return
}
state.DeployCluster(utils.ContractsDir)
t.Cleanup(func() {
if err := actions.TeardownSuite(t, state.Common.Env, "logs", state.ChainlinkNodes, nil, zapcore.PanicLevel, nil); err != nil {
l.Error().Err(err).Msg("Error tearing down environment")
Expand All @@ -47,14 +51,16 @@ func TestSolanaGauntletOCRV2Smoke(t *testing.T) {
l := ctfUtils.GetTestLogger(t)
secret := "this is an testing only secret"
state := common.NewOCRv2State(t, 1, "gauntlet", "devnet")
sg, err := gauntlet.NewSolanaGauntlet(fmt.Sprintf("%s/gauntlet", utils.ProjectRoot))

err = state.Common.Env.Run()
require.NoError(t, err)

if state.Common.Env.WillUseRemoteRunner() {
// run the remote runner and exit
err := state.Common.Env.Run()
require.NoError(t, err)
return
}
sg, err := gauntlet.NewSolanaGauntlet(fmt.Sprintf("%s/gauntlet", utils.ProjectRoot))
require.NoError(t, err)
err = state.Common.Env.Run()
require.NoError(t, err)
t.Cleanup(func() {
if err := actions.TeardownSuite(t, state.Common.Env, "logs", state.ChainlinkNodes, nil, zapcore.PanicLevel, nil); err != nil {
l.Error().Err(err).Msg("Error tearing down environment")
Expand All @@ -74,6 +80,7 @@ func TestSolanaGauntletOCRV2Smoke(t *testing.T) {
// Setting up RPC
c := rpc.New(gauntletConfig["NODE_URL"])
wsc, err := ws.Connect(context.Background(), gauntletConfig["WS_URL"])
require.NoError(t, err)

_, err = sg.DeployOCR2()
require.NoError(t, err, "Error deploying OCR")
Expand Down Expand Up @@ -119,6 +126,7 @@ func TestSolanaGauntletOCRV2Smoke(t *testing.T) {

require.NoError(t, err)
err = sg.ConfigureOCR2(onChainConfig, offChainConfig, payees, proposalAccept)
require.NoError(t, err)

err = state.Common.CreateSolanaChainAndNode(state.ChainlinkNodes)
require.NoError(t, err)
Expand Down
6 changes: 5 additions & 1 deletion integration-tests/soak/ocr2_soak_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ import (
"time"

"github.com/smartcontractkit/chainlink-solana/integration-tests/utils"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-solana/integration-tests/common"
)

func TestSolanaOCRV2SoakTest(t *testing.T) {
state := common.NewOCRv2State(t, 5, "soak", "localnet")
state.DeployCluster(utils.ContractsDir)
if state.Common.Env.WillUseRemoteRunner() {
// run the remote runner and exit
err := state.Common.Env.Run()
require.NoError(t, err)
return
}
state.DeployCluster(utils.ContractsDir)
state.SetAllAdapterResponsesToTheSameValue(10)
state.ValidateRoundsAfter(time.Now(), common.NewSoakRoundsCheckTimeout, 20000)
}

0 comments on commit 9b0e20e

Please sign in to comment.