Skip to content

Commit

Permalink
Use test secrets for E2E tests (#817)
Browse files Browse the repository at this point in the history
* Rebase

* Fix lint

* Bump run-tests action

* Add default solana secret

* Fix DEFAULT_CHAINLINK_IMAGE

* Fix

* Bump gha

* Fix

---------

Co-authored-by: Damjan Smickovski <[email protected]>
Co-authored-by: Aaron Lu <[email protected]>
  • Loading branch information
3 people committed Sep 4, 2024
1 parent 880f71f commit 62d447e
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 33 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/e2e_custom_cl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ jobs:
run: | # https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/config/README.md
cat << EOF > config.toml
[ChainlinkImage]
image="${{ env.CL_ECR }}"
version="solana.${{ env.CUSTOM_CORE_REF || github.event.inputs.cl_branch_ref || github.sha }}"
[Common]
user="${{ github.actor }}"
Expand All @@ -315,10 +314,11 @@ jobs:
# shellcheck disable=SC2086
echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c164251be2a7c5b2b23a6e5f7014982f232c14 # v2.3.31
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 | gotestloghelper -ci=true -singlepackage=true -hidepassingtests=false -hidepassinglogs=false
test_download_vendor_packages_command: cd ./integration-tests && go mod download
test_config_override_base64: ${{ env.BASE64_CONFIG_OVERRIDE }}
download_contract_artifacts_path: ${{ env.CONTRACT_ARTIFACTS_PATH }}
go_mod_path: ./integration-tests/go.mod
cl_repo: ${{ env.CL_ECR }}
Expand All @@ -332,6 +332,9 @@ jobs:
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
cache_key_id: solana-e2e-${{ env.MOD_CACHE_VERSION }}
cache_restore_only: "false"
env:
E2E_TEST_CHAINLINK_IMAGE: ${{ env.CL_ECR }}
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret

e2e_program_upgrade_tests:
name: E2E Program Upgrade Tests
Expand Down Expand Up @@ -394,10 +397,11 @@ jobs:
# shellcheck disable=SC2086
echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV
- name: Run Upgrade Test
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c164251be2a7c5b2b23a6e5f7014982f232c14 # v2.3.31
with:
test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestSolanaOCRV2UpgradeSmoke -json $(args) ./smoke 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci=true -singlepackage=true -hidepassingtests=false -hidepassinglogs=false
test_download_vendor_packages_command: cd ./integration-tests && go mod download
test_config_override_base64: ${{ env.BASE64_CONFIG_OVERRIDE }}
download_contract_artifacts_path: ${{ env.CONTRACT_ARTIFACTS_PATH }}
go_mod_path: ./integration-tests/go.mod
cl_repo: ${{ env.CL_ECR }}
Expand All @@ -411,3 +415,7 @@ jobs:
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
cache_key_id: solana-e2e-${{ env.MOD_CACHE_VERSION }}
cache_restore_only: "false"
env:
E2E_TEST_CHAINLINK_IMAGE: ${{ env.CL_ECR }}
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret

32 changes: 13 additions & 19 deletions .github/workflows/e2e_testnet_daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,10 @@ on:
required: true
default: develop
type: string
RPC_URL:
description: RPC URL for the tests
required: true
default: https://api.devnet.solana.com
type: string
WS_URL:
description: WS URL for the tests
required: true
default: wss://api.devnet.solana.com/
type: string
PRIVATE_KEY:
description: Private key in byte format [12, 12 ...]
required: true
type: string
test_secrets_override_key:
description: 'Key to run tests with custom test secrets like ws url, rpc url, private key, etc.'
required: false
type: string
schedule:
- cron: '0 6 * * *'
# Only run 1 of this workflow at a time per PR
Expand Down Expand Up @@ -147,15 +137,11 @@ jobs:
run: | # https://github.com/smartcontractkit/chainlink-testing-framework/blob/main/config/README.md
cat << EOF > config.toml
[ChainlinkImage]
image="${{ env.CL_ECR }}"
version="solana.${{ env.CUSTOM_CORE_REF || github.event.inputs.cl_branch_ref || github.sha }}"
[Common]
user="${{ github.actor }}"
network="devnet"
private_key="${{ github.event_name == 'workflow_dispatch' && github.event.inputs.PRIVATE_KEY || secrets.PRIVATE_KEY }}"
internal_docker_repo = "${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com"
rpc_url = "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.RPC_URL || 'https://api.devnet.solana.com' }}"
ws_url = "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.RPC_URL || 'https://api.devnet.solana.com' }}"
EOF
# shellcheck disable=SC2002
Expand All @@ -165,10 +151,12 @@ jobs:
# shellcheck disable=SC2086
echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@b49a9d04744b0237908831730f8553f26d73a94b # v2.3.17
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fdaf56b1df7248d18e30ad09982d03ec67d6b71c # v2.3.29
with:
test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestSolanaOCRV2Smoke/embedded -json $(args) ./smoke 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage
test_download_vendor_packages_command: cd ./integration-tests && go mod download
test_config_override_base64: ${{ env.BASE64_CONFIG_OVERRIDE }}
test_secrets_override_base64: ${{ secrets[inputs.test_secrets_override_key] }}
download_contract_artifacts_path: ${{ env.CONTRACT_ARTIFACTS_PATH }}
go_mod_path: ./integration-tests/go.mod
cl_repo: ${{ env.CL_ECR }}
Expand All @@ -182,3 +170,9 @@ jobs:
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
cache_key_id: solana-e2e-${{ env.MOD_CACHE_VERSION }}
cache_restore_only: "false"
DEFAULT_CHAINLINK_IMAGE: ${{ env.CL_ECR }}
env:
E2E_TEST_COMMON_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} # default private key
E2E_TEST_COMMON_RPC_URL: https://api.devnet.solana.com # default url
E2E_TEST_COMMON_WS_URL: https://api.devnet.solana.com # default url
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret
12 changes: 10 additions & 2 deletions .github/workflows/soak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ on:
workflow_dispatch:
inputs:
base64_config:
description: Your .toml file as base64
description: Your .toml file as base64 (must NOT contain test secrets)
required: true
test_secrets_override_key:
description: 'Key to run tests with custom test secrets like ws url, rpc url, private key, etc.'
required: false
type: string
cl_image_tag:
description: Core image tag
required: true
Expand Down Expand Up @@ -92,10 +96,12 @@ jobs:
echo "::add-mask::$BASE64_CONFIG_OVERRIDE"
echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> "$GITHUB_ENV"
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@b49a9d04744b0237908831730f8553f26d73a94b # v2.3.17
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@fdaf56b1df7248d18e30ad09982d03ec67d6b71c # v2.3.29
with:
test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestSolanaOCRV2Soak/embedded -json $(args) ./soak 2>&1 | tee /tmp/gotest.log | gotestloghelper -ci -singlepackage
test_download_vendor_packages_command: cd ./integration-tests && go mod download
test_config_override_base64: ${{ env.BASE64_CONFIG_OVERRIDE }}
test_secrets_override_base64: ${{ secrets[inputs.test_secrets_override_key] }}
download_contract_artifacts_path: ${{ env.CONTRACT_ARTIFACTS_PATH }}
go_mod_path: ./integration-tests/go.mod
cl_repo: ${{ env.CL_ECR }}
Expand All @@ -109,3 +115,5 @@ jobs:
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
cache_key_id: solana-e2e-${{ env.MOD_CACHE_VERSION }}
cache_restore_only: "false"
env:
E2E_TEST_SOLANA_SECRET: thisisatestingonlysecret
2 changes: 1 addition & 1 deletion docs/RunningE2eTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Devnet requires previously deployed programs that are owned by the person runnin

- `Common.network` needs to be set to `devnet` which will instruct the tests to run against devnet
- `ocr2_program_id`, `access_controller_program_id`, `store_program_id`, `link_token_address`, `vault_address` need to be set so the tests know what programs to use so we avoid deploying each time.
- `rpc_url` and `ws_url` need to be set
- `E2E_TEST_COMMON_RPC_URL` and `E2E_TEST_COMMON_WS_URL` need to be set

**Localnet**
Setting localnet will instruct the tests to run in localnet, the program ID's are not taken from the TOML in this scenario, but rather defined in the `integration-tests/config/config.go`.
Expand Down
3 changes: 0 additions & 3 deletions integration-tests/testconfig/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@ access_controller_program_id = "9xi644bRR8birboDGdTiwBq3C7VEeR7VuamRYYXCubUW"
store_program_id = "HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny"
link_token_address = "7CF1GrsZsny5j9JESPj98MdYVZK38RE8ZpmTEMwECK4c"
vault_address = "FdM4dnhVpFQfjPqNG6LEfzArhuGhUjtidYu89qtGwJCS"
secret="thisisatestingonlysecret"

[Common]
rpc_url = "https://api.devnet.solana.com"
ws_url = "wss://api.devnet.solana.com/"
internal_docker_repo = "public.ecr.aws/chainlink"
inside_k8 = false
network = "localnet"
Expand Down
Loading

0 comments on commit 62d447e

Please sign in to comment.