From bb727853cf256eda57c33921579e0cdd2e7f7ae2 Mon Sep 17 00:00:00 2001 From: Tate Date: Mon, 24 Jul 2023 08:37:04 -0600 Subject: [PATCH] Simplify remote runner by moving logic to beginning of tests --- .github/actions/build-test-image/action.yml | 2 +- .github/workflows/e2e_custom_cl.yml | 8 +++--- .github/workflows/e2e_testnet_daily.yml | 8 +++--- integration-tests/common/test_common.go | 14 +++++++++++ integration-tests/smoke/ocr2_test.go | 27 ++++++++++++++------- integration-tests/soak/ocr2_soak_test.go | 6 ++++- 6 files changed, 46 insertions(+), 19 deletions(-) diff --git a/.github/actions/build-test-image/action.yml b/.github/actions/build-test-image/action.yml index a85ccbcc6..0877c4dce 100644 --- a/.github/actions/build-test-image/action.yml +++ b/.github/actions/build-test-image/action.yml @@ -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 }} diff --git a/.github/workflows/e2e_custom_cl.yml b/.github/workflows/e2e_custom_cl.yml index 1b600d74b..000981231 100644 --- a/.github/workflows/e2e_custom_cl.yml +++ b/.github/workflows/e2e_custom_cl.yml @@ -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 }} @@ -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 }} @@ -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 @@ -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 \ No newline at end of file + should_cleanup: false diff --git a/.github/workflows/e2e_testnet_daily.yml b/.github/workflows/e2e_testnet_daily.yml index fa907ca56..f469c3737 100644 --- a/.github/workflows/e2e_testnet_daily.yml +++ b/.github/workflows/e2e_testnet_daily.yml @@ -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 }} @@ -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 }} @@ -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 @@ -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 \ No newline at end of file + should_cleanup: false diff --git a/integration-tests/common/test_common.go b/integration-tests/common/test_common.go index 5caa567ed..b45582fed 100644 --- a/integration-tests/common/test_common.go +++ b/integration-tests/common/test_common.go @@ -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", + }) +} diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index cb70f2040..c611909f9 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -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" @@ -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" @@ -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") @@ -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") @@ -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") @@ -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) diff --git a/integration-tests/soak/ocr2_soak_test.go b/integration-tests/soak/ocr2_soak_test.go index cd60b4548..64d4e201f 100644 --- a/integration-tests/soak/ocr2_soak_test.go +++ b/integration-tests/soak/ocr2_soak_test.go @@ -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) }