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 bb72785
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-test-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ runs:
file: ./integration-tests/test.Dockerfile
build-args: |
BASE_IMAGE=${{ inputs.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ inputs.QA_AWS_REGION }}.amazonaws.com/test-base-image
IMAGE_VERSION=v0.33.0
IMAGE_VERSION=v0.35.0
SUITES="soak smoke"
AWS_REGION: ${{ inputs.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/e2e_custom_cl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
steps:
- name: Check if image exists
id: check-image
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.0
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.1
with:
repository: chainlink-solana-tests
tag: ${{ github.sha }}
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
steps:
- name: Check if image exists
id: check-image
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.0
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.1
with:
repository: chainlink
tag: solana.${{ github.sha }}
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
- name: Checkout the repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.0
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.1
with:
test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestSolanaOCRV2Smoke -json $(args) ./smoke 2>&1 | tee /tmp/gotest.log | gotestfmt
go_mod_path: ./integration-tests/go.mod
Expand All @@ -172,4 +172,4 @@ jobs:
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
should_cleanup: false
should_cleanup: false
8 changes: 4 additions & 4 deletions .github/workflows/e2e_testnet_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
steps:
- name: Check if image exists
id: check-image
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.0
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.1
with:
repository: chainlink-solana-tests
tag: ${{ github.sha }}
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
steps:
- name: Check if image exists
id: check-image
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.0
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.1
with:
repository: chainlink
tag: solana.${{ github.sha }}
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
- name: Checkout the repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.0
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@ad22fbd6f4d108b82aaf49b527bcf40f32babea8 # v2.2.1
with:
test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestSolanaGauntletOCRV2Smoke -json $(args) ./smoke 2>&1 | tee /tmp/gotest.log | gotestfmt
go_mod_path: ./integration-tests/go.mod
Expand All @@ -195,4 +195,4 @@ jobs:
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
should_cleanup: false
should_cleanup: false
14 changes: 14 additions & 0 deletions integration-tests/common/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,3 +564,17 @@ func (m *OCRv2TestState) ConfigureGauntlet(secret string) map[string]string {
}

}

// GauntletEnvToRemoteRunner Setup the environment variables that will be needed inside the remote runner
func (m *OCRv2TestState) GauntletEnvToRemoteRunner() {
utils.SetupEnvVarsForRemoteRunner([]string{
"RPC_URL",
"WS_URL",
"PRIVATE_KEY",
"PROGRAM_ID_OCR2",
"PROGRAM_ID_ACCESS_CONTROLLER",
"PROGRAM_ID_STORE",
"LINK_TOKEN",
"VAULT_ADDRESS",
})
}
27 changes: 18 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,17 @@ 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
state.GauntletEnvToRemoteRunner()
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 +81,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 +127,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 bb72785

Please sign in to comment.