Skip to content

Commit

Permalink
Add Gauntlet++ Op Client and Op Requests into E2E Integration Tests (#…
Browse files Browse the repository at this point in the history
…548)

* gpp start

* Initial G++ E2E Ops

* Added logging

* More gpp ops

* Logging and OCR2 ops

* Removed comments

* Go mod

* Refactor for Sonarqube

* Adding G++ go env

* Revert "Adding G++ go env"

This reverts commit 358cf94.

* Adding GOPRIVATE Env to relayer

* Revision changes

* Trying to use GOPRIVATE with GHT

* Testing GATI

* Added OZ Account deploy and refactored to declare into deploy ops

* Added secrest for GHA

* Added permissions

* Adding GOPRIVATE

* Changed access token to output of gati

* explicit gpp repo

* wip

* Adding explicit definition

* Added GOENV

* debug step

* oath2

* new auth url

* Revision to stable version

* Fix dependencies

* Fixed lint and other workflows

* permissions

* Added actions GATI

* Reverted some stuff

* Moved GATI action back into action

* inputs typo

* Sending GATI token into dockerfile

* Echo debug

* Moved it up to see if it runs

* Bash syntax

* lint changes

* Lint and adding new token to workflow

* Fix

* Adding new command to pass workflow

* Lint fix

* Editted Makefile and workflow

* Right path to makefile

* Fixed file path for lint skip

* Barebones command for env

* Re-addedo org work flow

* Pull from new chainlink-github-actions tag

* commit hash bump for testing framework

* bump

* Removed unnec command

* bump run-tests version

* remove unused linter from common

* re-added vender command

* Using qa repo for github actions

* ARG to ENV to fix sonarqube

* Re-added github token as ARG

* Refactored out setting github configs with gati token

* fix indentation
  • Loading branch information
chray-zhang authored Nov 21, 2024
1 parent 16426aa commit 2a39b51
Show file tree
Hide file tree
Showing 19 changed files with 660 additions and 23 deletions.
8 changes: 8 additions & 0 deletions .github/actions/build-test-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ inputs:
QA_AWS_ACCOUNT_NUMBER:
description: The AWS region the ECR repository is located in, should only be needed for public ECR repositories, used in configuring docker/login-action
required: true
GITHUB_TOKEN:
description: GATI Token used to pull private repositories
required: true

runs:
using: composite
Expand All @@ -32,6 +35,10 @@ runs:
tag: ${{ inputs.tag }}
AWS_REGION: ${{ inputs.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
- name: Setup Go with private repo access
uses: ./.github/actions/setup-github-private-access
with:
gati_token: ${{ inputs.GITHUB_TOKEN }}
- name: Build and Publish Test Runner
if: steps.check-image.outputs.exists == 'false'
uses: smartcontractkit/chainlink-github-actions/docker/build-push@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19
Expand All @@ -42,6 +49,7 @@ runs:
file: ./integration-tests/test.Dockerfile
build-args: |
SUITES="smoke soak"
GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }}
AWS_REGION: ${{ inputs.QA_AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ inputs.QA_AWS_ROLE_TO_ASSUME }}
- name: Print Image Built
Expand Down
16 changes: 16 additions & 0 deletions .github/actions/setup-github-private-access/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Setup GitHub Private Repo Access
description: Uses a GATI Token to be able to pull from private repos

inputs:
gati_token:
description: 'GATI Token used to pull private repos'
required: true

runs:
using: 'composite'
steps:
- name: Setup Go with private repo access
shell: bash
run: |
git config --global url."https://x-access-token:${{ inputs.gati_token }}@github.com/".insteadOf "https://github.com/"
go env -w GOPRIVATE=github.com/smartcontractkit/*
28 changes: 28 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,24 @@ jobs:
golang_lint_ops:
name: Golang Lint Ops
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
needs: [golangci-lint-version]
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup GitHub Token
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.GATI_RELENG_LAMBDA_URL }}
aws-region: ${{ secrets.QA_AWS_REGION }}
- name: Setup Go with private repo access
uses: ./.github/actions/setup-github-private-access
with:
gati_token: ${{ steps.setup-github-token.outputs.access-token }}
- name: Install Nix
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6
with:
Expand All @@ -74,10 +88,24 @@ jobs:
golang_lint_integration_tests:
name: Golang Lint Integration Tests
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
needs: [golangci-lint-version]
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup GitHub Token
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.GATI_RELENG_LAMBDA_URL }}
aws-region: ${{ secrets.QA_AWS_REGION }}
- name: Setup Go with private repo access
uses: ./.github/actions/setup-github-private-access
with:
gati_token: ${{ steps.setup-github-token.outputs.access-token }}
- name: Install Nix
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6
with:
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/integration-tests-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ jobs:
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }}
this-job-name: Build Test Image
continue-on-error: true
- name: Setup GitHub Token
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.GATI_RELENG_LAMBDA_URL }}
aws-region: ${{ secrets.QA_AWS_REGION }}
- name: Checkout the repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
Expand All @@ -119,6 +126,7 @@ jobs:
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ACCOUNT_NUMBER: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
GITHUB_TOKEN: ${{ steps.setup-github-token.outputs.access-token }}

run_tests:
name: Run Smoke Tests ${{matrix.image.name}}
Expand Down Expand Up @@ -162,6 +170,13 @@ jobs:
nix_path: nixpkgs=channel:nixos-unstable
- name: Install Cairo
uses: ./.github/actions/install-cairo
- name: Setup GitHub Token
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.GATI_RELENG_LAMBDA_URL }}
aws-region: ${{ secrets.QA_AWS_REGION }}
- name: Build contracts
run: |
cd contracts && scarb --profile release build
Expand All @@ -184,7 +199,7 @@ jobs:
# shellcheck disable=SC2086
echo "BASE64_CONFIG_OVERRIDE=$BASE64_CONFIG_OVERRIDE" >> $GITHUB_ENV
- name: Run Tests ${{ matrix.image.name }}
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c164251be2a7c5b2b23a6e5f7014982f232c14 # v2.3.31
uses: smartcontractkit/.github/actions/ctf-run-tests@002596f65dc8eb807f5c8729dc1080921f7d0b24 # 0.2.1
with:
aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
test_command_to_run: nix develop -c sh -c "make test=${{ matrix.image.test-name }} test-integration-smoke-ci"
Expand All @@ -197,6 +212,7 @@ jobs:
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
artifacts_location: /home/runner/work/chainlink-starknet/chainlink-starknet/integration-tests/smoke/logs
gati_token: ${{ steps.setup-github-token.outputs.access-token }}
env:
KILLGRAVE_INTERNAL_IMAGE: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/friendsofgo/killgrave
CHAINLINK_IMAGE: ${{ env.CL_ECR }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-soak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ 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@00c164251be2a7c5b2b23a6e5f7014982f232c14 # v2.3.31
uses: smartcontractkit/.github/actions/ctf-run-tests@002596f65dc8eb807f5c8729dc1080921f7d0b24 # 0.2.1
with:
aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
test_command_to_run: cd ./integration-tests && go test -timeout 24h -count=1 -run TestOCRBasicSoak/embedded ./soak
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,27 @@ jobs:
check-tidy:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: "relayer/go.mod"
- name: Setup GitHub Token
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.GATI_RELENG_LAMBDA_URL }}
aws-region: ${{ secrets.QA_AWS_REGION }}
- name: Setup Go with private repo access
uses: ./.github/actions/setup-github-private-access
with:
gati_token: ${{ steps.setup-github-token.outputs.access-token }}
- name: Ensure "make gomodtidy" has been run
run: |
make gomodtidy
Expand Down
7 changes: 6 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,9 @@ issues:
- path: test
text: "^G404:"
linters:
- gosec
- gosec
# TODO: re-add gpp op file once we integrate into workflows
- path: "common/gauntlet_plus_plus_common.go"
text: ".*"
linters:
- unused
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ format-ts-check:

.PHONY: lint-go-ops
lint-go-ops:
cd ./ops && golangci-lint --color=always --out-format checkstyle:golangci-lint-ops-report.xml run
cd ./ops && golangci-lint --config ../.golangci.yml --color=always --out-format checkstyle:golangci-lint-ops-report.xml run

.PHONY: lint-go-relayer
lint-go-relayer:
cd ./relayer && golangci-lint --color=always --out-format checkstyle:golangci-lint-relayer-report.xml run
cd ./relayer && golangci-lint --config ../.golangci.yml --color=always --out-format checkstyle:golangci-lint-relayer-report.xml run

.PHONY: lint-go-test
lint-go-test:
cd ./integration-tests && golangci-lint --color=always --exclude=dot-imports --out-format checkstyle:golangci-lint-integration-tests-report.xml run
cd ./integration-tests && golangci-lint --config ../.golangci.yml --color=always --exclude=dot-imports --out-format checkstyle:golangci-lint-integration-tests-report.xml run

.PHONY: test-go
test-go: test-unit-go test-unit-go-race test-integration-go
Expand Down
57 changes: 57 additions & 0 deletions integration-tests/common/gauntlet_plus_plus_common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package common

import (
"encoding/json"
"os"
)

func (m *OCRv2TestState) deployAccessControllerWithGpp() error {
var err error
m.Contracts.AccessControllerAddr, err = m.Clients.GauntletPPClient.DeployAccessControllerContract(m.Account.Account)
if err != nil {
return err
}
err = os.Setenv("BILLING_ACCESS_CONTROLLER", m.Contracts.AccessControllerAddr)
if err != nil {
return err
}
return nil
}

func (m *OCRv2TestState) declareLinkToken() error {
err := m.Clients.GauntletPPClient.DeclareLinkTokenContract()
if err != nil {
return err
}

return nil
}

func (m *OCRv2TestState) deployLinkTokenWithGpp() error {
var err error
m.Contracts.LinkTokenAddr, err = m.Clients.GauntletPPClient.DeployLinkTokenContract(m.Account.Account)

if err != nil {
return err
}

err = os.Setenv("LINK", m.Contracts.LinkTokenAddr)
if err != nil {
return err
}
return nil
}

func (m *OCRv2TestState) setConfigDetailsWithGpp(ocrAddress string) error {
cfg, err := m.LoadOCR2Config()
if err != nil {
return err
}
var parsedConfig []byte
parsedConfig, err = json.Marshal(cfg)
if err != nil {
return err
}
_, err = m.Clients.GauntletPPClient.SetConfigDetails(string(parsedConfig), ocrAddress)
return err
}
16 changes: 9 additions & 7 deletions integration-tests/common/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ type AccountDetails struct {

// Clients to access internal methods
type Clients struct {
StarknetClient *starknet.Client
DevnetClient *starknetdevnet.DevNet
KillgraveClient *test_env_ctf.Killgrave
OCR2Client *ocr2.Client
ChainlinkClient *ChainlinkClient
GauntletClient *gauntlet.StarknetGauntlet
DockerEnv *StarknetClusterTestEnv
StarknetClient *starknet.Client
DevnetClient *starknetdevnet.DevNet
KillgraveClient *test_env_ctf.Killgrave
OCR2Client *ocr2.Client
ChainlinkClient *ChainlinkClient
GauntletClient *gauntlet.StarknetGauntlet
DockerEnv *StarknetClusterTestEnv
GauntletPPClient *gauntlet.StarknetGauntletPlusPlus
}

// Contracts to store current deployed contract state
Expand Down Expand Up @@ -212,6 +213,7 @@ func (m *OCRv2TestState) DeployCluster() {
m.Clients.ChainlinkClient.NKeys, m.TestConfig.err = m.Common.CreateNodeKeysBundle(m.Clients.DockerEnv.CLClusterTestEnv.ClCluster.NodeAPIs())
require.NoError(m.TestConfig.T, m.TestConfig.err)
}

lggr := logger.Nop()
m.Clients.StarknetClient, m.TestConfig.err = starknet.NewClient(m.Common.ChainDetails.ChainID, m.Common.RPCDetails.RPCL2External, m.Common.RPCDetails.RPCL2InternalAPIKey, lggr, &rpcRequestTimeout)
require.NoError(m.TestConfig.T, m.TestConfig.err, "Creating starknet client should not fail")
Expand Down
7 changes: 7 additions & 0 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ require (
github.com/XSAM/otelsql v0.27.0 // indirect
github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/atombender/go-jsonschema v0.16.1-0.20240916205339-a74cd4e2851c // indirect
Expand Down Expand Up @@ -166,6 +167,7 @@ require (
github.com/gagliardetto/treeout v0.1.4 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/getkin/kin-openapi v0.120.0 // indirect
github.com/getsentry/sentry-go v0.23.0 // indirect
github.com/gin-contrib/sessions v0.0.5 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
Expand Down Expand Up @@ -267,6 +269,7 @@ require (
github.com/imdario/mergo v0.3.16 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/jsonschema v0.12.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.3 // indirect
github.com/jackc/pgio v1.0.0 // indirect
Expand Down Expand Up @@ -321,6 +324,7 @@ require (
github.com/moby/term v0.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
github.com/morikuni/aec v1.0.0 // indirect
Expand All @@ -330,6 +334,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/oapi-codegen/runtime v1.1.1 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
Expand All @@ -342,6 +347,7 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
Expand Down Expand Up @@ -385,6 +391,7 @@ require (
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241010140936-4e1d0ae8315a // indirect
github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 // indirect
github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 // indirect
github.com/smartcontractkit/gauntlet-plus-plus/sdks/go-gauntlet v1.1.3 // indirect
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 // indirect
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect
Expand Down
Loading

0 comments on commit 2a39b51

Please sign in to comment.