Skip to content

Commit

Permalink
Fix LP tests filters check and add to smoke tests in CI (#11649)
Browse files Browse the repository at this point in the history
* fix hasFilters, fix cancelling log emission in case of errors, add some sanity checks, add 3 log poller tests to integration pipeline

* fix replay test

* fix lints

* shorten chaos log poller test

* remove debug logs

* disable backup poller. DO NOT MERGE THIS

* make it configurable which container is paused: cl node or postgres

* try Domino's way of stopping log poller

* fix smoke test job name

* remove unnecessary check

* try executing postgress pausing lp test, more debug info about missing logs if any are missing

* fix lints

* revert disabling of backpolling, simplify some code, less logs

* make optional parameters not required in lp on demand test

* run lp smoke tests in a separate job

* prepare log poller json test list

* add missing comma, revert some comments

* fix filename for lp matrix job

* move log poller scenarios to test file, remove unused load test

* reduce code duplication in lp tests

* fix lp tests, fix smoke workflow

* remove commented out sections, remove cosmossdk.io/errors

* removed trailing spaces, added comments to functions
  • Loading branch information
Tofel authored Jan 23, 2024
1 parent 6771c0a commit 139fb1a
Show file tree
Hide file tree
Showing 11 changed files with 857 additions and 734 deletions.
88 changes: 81 additions & 7 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ jobs:
runs-on: ubuntu-latest
name: Compare/Build Automation Test List
outputs:
matrix: ${{ env.MATRIX_JSON }}
automation-matrix: ${{ env.AUTOMATION_JOB_MATRIX_JSON }}
lp-matrix: ${{ env.LP_JOB_MATRIX_JSON }}
steps:
- name: Check for Skip Tests Label
if: contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests')
Expand All @@ -203,6 +204,7 @@ jobs:
cd ./integration-tests
./scripts/compareTestList.sh ./smoke/automation_test.go
./scripts/compareTestList.sh ./smoke/keeper_test.go
./scripts/compareTestList.sh ./smoke/log_poller_test.go
- name: Build Test Matrix Lists
id: build-test-matrix-list
run: |
Expand All @@ -211,19 +213,22 @@ jobs:
MATRIX_JSON_KEEPER=$(./scripts/buildTestMatrixList.sh ./smoke/keeper_test.go keeper ubuntu-latest 1)
COMBINED_ARRAY=$(jq -c -n "$MATRIX_JSON_AUTOMATION + $MATRIX_JSON_KEEPER")
LOG_POLLER_MATRIX_JSON=$(./scripts/buildTestMatrixList.sh ./smoke/log_poller_test.go log_poller ubuntu-latest 1)
echo "LP_JOB_MATRIX_JSON=${LOG_POLLER_MATRIX_JSON}" >> $GITHUB_ENV
# if we running a PR against the develop branch we should only run the automation tests unless we are in the merge group event
if [[ "$GITHUB_EVENT_NAME" == "merge_group" ]]; then
echo "We are in a merge_group event, run both automation and keepers tests"
echo "MATRIX_JSON=${COMBINED_ARRAY}" >> $GITHUB_ENV
echo "AUTOMATION_JOB_MATRIX_JSON=${COMBINED_ARRAY}" >> $GITHUB_ENV
else
echo "we are not in a merge_group event, if this is a PR to develop run only automation tests, otherwise run everything because we could be running against a release branch"
target_branch=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.base.ref)
if [[ "$target_branch" == "develop" ]]; then
echo "only run automation tests"
echo "MATRIX_JSON=${MATRIX_JSON_AUTOMATION}" >> $GITHUB_ENV
echo "AUTOMATION_JOB_MATRIX_JSON=${MATRIX_JSON_AUTOMATION}" >> $GITHUB_ENV
else
echo "run both automation and keepers tests"
echo "MATRIX_JSON=${COMBINED_ARRAY}" >> $GITHUB_ENV
echo "AUTOMATION_JOB_MATRIX_JSON=${COMBINED_ARRAY}" >> $GITHUB_ENV
fi
fi
Expand All @@ -245,7 +250,7 @@ jobs:
strategy:
fail-fast: false
matrix:
product: ${{fromJson(needs.compare-tests.outputs.matrix)}}
product: ${{fromJson(needs.compare-tests.outputs.automation-matrix)}}
runs-on: ${{ matrix.product.os }}
name: ETH Smoke Tests ${{ matrix.product.name }}
steps:
Expand Down Expand Up @@ -286,7 +291,7 @@ jobs:
LOGSTREAM_LOG_TARGETS: ${{ vars.LOGSTREAM_LOG_TARGETS }}
GRAFANA_URL: ${{ vars.GRAFANA_URL }}
GRAFANA_DATASOURCE: ${{ vars.GRAFANA_DATASOURCE }}
RUN_ID: ${{ github.run_id }}
RUN_ID: ${{ github.run_id }}
with:
test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -test.parallel=${{ matrix.product.nodes }} ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestfmt
test_download_vendor_packages_command: cd ./integration-tests && go mod download
Expand All @@ -306,6 +311,75 @@ jobs:
if: always()
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/show-test-summary@ea889b3133bd7f16ab19ba4ba130de5d9162c669 # v2.3.4

eth-smoke-tests-matrix-log-poller:
if: ${{ !(contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') || github.event_name == 'workflow_dispatch') }}
environment: integration
permissions:
checks: write
pull-requests: write
id-token: write
contents: read
needs:
[build-chainlink, changes, compare-tests, build-lint-integration-tests]
env:
SELECTED_NETWORKS: SIMULATED,SIMULATED_1,SIMULATED_2
CHAINLINK_COMMIT_SHA: ${{ github.sha }}
CHAINLINK_ENV_USER: ${{ github.actor }}
TEST_LOG_LEVEL: debug
strategy:
fail-fast: false
matrix:
product: ${{fromJson(needs.compare-tests.outputs.lp-matrix)}}
runs-on: ${{ matrix.product.os }}
name: ETH Smoke Tests ${{ matrix.product.name }}
steps:
- name: Collect Metrics
if: needs.changes.outputs.src == 'true'
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d1618b772a97fd87e6505de97b872ee0b1f1729a # v2.0.2
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: ETH Smoke Tests ${{ matrix.product.name }}
test-results-file: '{"testType":"go","filePath":"/tmp/gotest.log"}'
continue-on-error: true
- name: Checkout the repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Build Go Test Command
id: build-go-test-command
run: |
# if the matrix.product.run is set, use it for a different command
if [ "${{ matrix.product.run }}" != "" ]; then
echo "run_command=${{ matrix.product.run }} ./smoke/${{ matrix.product.file }}_test.go" >> "$GITHUB_OUTPUT"
else
echo "run_command=./smoke/${{ matrix.product.name }}_test.go" >> "$GITHUB_OUTPUT"
fi
## Run this step when changes that require tests to be run are made
- name: Run Tests
if: needs.changes.outputs.src == 'true'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@e865e376b8c2d594028c8d645dd6c47169b72974 # v2.2.16
env:
PYROSCOPE_SERVER: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725
PYROSCOPE_ENVIRONMENT: ${{ matrix.product.pyroscope_env }}
PYROSCOPE_KEY: ${{ secrets.QA_PYROSCOPE_KEY }}
with:
test_command_to_run: cd ./integration-tests && go test -timeout 30m -count=1 -json -test.parallel=${{ matrix.product.nodes }} ${{ steps.build-go-test-command.outputs.run_command }} 2>&1 | tee /tmp/gotest.log | gotestfmt
test_download_vendor_packages_command: cd ./integration-tests && go mod download
cl_repo: ${{ env.CHAINLINK_IMAGE }}
cl_image_tag: ${{ github.sha }}
aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
artifacts_location: ./integration-tests/smoke/logs/
publish_check_name: ${{ matrix.product.name }}
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
cache_key_id: core-e2e-${{ env.MOD_CACHE_VERSION }}
cache_restore_only: "true"
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ""

eth-smoke-tests-matrix:
if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') }}
environment: integration
Expand Down Expand Up @@ -505,7 +579,7 @@ jobs:
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: trace-data
path: ./integration-tests/smoke/traces/trace-data.json
path: ./integration-tests/smoke/traces/trace-data.json
- name: Print failed test summary
if: always()
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/show-test-summary@ea889b3133bd7f16ab19ba4ba130de5d9162c669 # v2.3.4
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/on-demand-log-poller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,22 @@ on:
required: true
selectedNetworks:
type: choice
description: Networks to test on
options:
- "SIMULATED"
- "SEPOLIA"
- "MUMBAI"
fundingPrivateKey:
description: Private funding key (Skip for Simulated)
required: true
required: false
type: string
wsURL:
description: WS URL for the network (Skip for Simulated)
required: true
required: false
type: string
httpURL:
description: HTTP URL for the network (Skip for Simulated)
required: true
required: false
type: string

jobs:
Expand Down Expand Up @@ -84,4 +85,4 @@ jobs:
run: |
cd integration-tests
go mod download
go test -v -timeout 5h -v -count=1 -run ^TestLogPollerFromEnv$ ./reorg/log_poller_maybe_reorg_test.go
go test -v -timeout 5h -v -count=1 -run ^TestLogPollerFewFiltersFixedDepth$ ./smoke/log_poller_test.go
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ go 1.21.4
replace github.com/smartcontractkit/chainlink/v2 => ../

require (
cosmossdk.io/errors v1.0.0
github.com/K-Phoen/grabana v0.21.17
github.com/cli/go-gh/v2 v2.0.0
github.com/ethereum/go-ethereum v1.13.8
Expand Down Expand Up @@ -60,6 +59,7 @@ require (
cosmossdk.io/api v0.3.1 // indirect
cosmossdk.io/core v0.5.1 // indirect
cosmossdk.io/depinject v1.0.0-alpha.3 // indirect
cosmossdk.io/errors v1.0.0 // indirect
cosmossdk.io/math v1.0.1 // indirect
dario.cat/mergo v1.0.0 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
Expand Down
22 changes: 0 additions & 22 deletions integration-tests/load/log_poller/config.toml

This file was deleted.

25 changes: 0 additions & 25 deletions integration-tests/load/log_poller/log_poller_test.go

This file was deleted.

43 changes: 0 additions & 43 deletions integration-tests/reorg/log_poller_maybe_reorg_test.go

This file was deleted.

Loading

0 comments on commit 139fb1a

Please sign in to comment.