Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase OCRv2 Test Speed #11973

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 65 additions & 45 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ jobs:
fi

eth-smoke-tests-matrix-automation:
if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') }}
if: false # DEBUG
# if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') }}
environment: integration
permissions:
checks: write
Expand Down Expand Up @@ -322,7 +323,8 @@ jobs:
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') }}
if: false # DEBUG
# if: ${{ !(contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') || github.event_name == 'workflow_dispatch') }}
environment: integration
permissions:
checks: write
Expand Down Expand Up @@ -422,56 +424,69 @@ jobs:
fail-fast: false
matrix:
product:
- name: runlog
nodes: 2
os: ubuntu-latest
pyroscope_env: "ci-smoke-runlog-evm-simulated"
- name: cron
nodes: 2
os: ubuntu-latest
pyroscope_env: "ci-smoke-cron-evm-simulated"
- name: flux
nodes: 1
os: ubuntu-latest
pyroscope_env: "ci-smoke-flux-evm-simulated"
- name: ocr
nodes: 2
os: ubuntu-latest
file: ocr
pyroscope_env: ci-smoke-ocr-evm-simulated
# - name: runlog
# nodes: 2
# os: ubuntu-latest
# pyroscope_env: "ci-smoke-runlog-evm-simulated"
# - name: cron
# nodes: 2
# os: ubuntu-latest
# pyroscope_env: "ci-smoke-cron-evm-simulated"
# - name: flux
# nodes: 1
# os: ubuntu-latest
# pyroscope_env: "ci-smoke-flux-evm-simulated"
# - name: ocr
# nodes: 2
# os: ubuntu-latest
# file: ocr
# pyroscope_env: ci-smoke-ocr-evm-simulated
- name: ocr2
nodes: 6
os: ubuntu-latest
os: ubuntu20.04-16cores-64GB
file: ocr2
pyroscope_env: ci-smoke-ocr2-evm-simulated
- name: ocr2
nodes: 6
os: ubuntu-latest
pyroscope_env: ci-smoke-ocr2-plugins-evm-simulated
tag_suffix: "-plugins"
- name: vrf
nodes: 2
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf-evm-simulated
- name: vrfv2
nodes: 4
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf2-evm-simulated
- name: vrfv2plus
nodes: 4
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf2plus-evm-simulated
- name: forwarder_ocr
nodes: 2
os: ubuntu-latest
pyroscope_env: ci-smoke-forwarder-ocr-evm-simulated
- name: forwarders_ocr2
nodes: 2
os: ubuntu-latest
pyroscope_env: ci-smoke-forwarder-ocr-evm-simulated
# - name: ocr2
# nodes: 6
# os: ubuntu20.04-16cores-64GB
# pyroscope_env: ci-smoke-ocr2-plugins-evm-simulated
# tag_suffix: "-plugins"
# - name: vrf
# nodes: 2
# os: ubuntu-latest
# pyroscope_env: ci-smoke-vrf-evm-simulated
# - name: vrfv2
# nodes: 4
# os: ubuntu-latest
# pyroscope_env: ci-smoke-vrf2-evm-simulated
# - name: vrfv2plus
# nodes: 4
# os: ubuntu-latest
# pyroscope_env: ci-smoke-vrf2plus-evm-simulated
# - name: forwarder_ocr
# nodes: 2
# os: ubuntu-latest
# pyroscope_env: ci-smoke-forwarder-ocr-evm-simulated
# - name: forwarders_ocr2
# nodes: 2
# os: ubuntu-latest
# pyroscope_env: ci-smoke-forwarder-ocr-evm-simulated
runs-on: ${{ matrix.product.os }}
name: ETH Smoke Tests ${{ matrix.product.name }}${{ matrix.product.tag_suffix }}
steps:
- name: Check it
run: |
echo "Docker Settings"
cat /etc/docker/daemon.json
echo "Docker Info"
docker info
echo "Resource Limits"
ulimit -a
echo "Docker Process Limits"
pidof dockerd
cat /proc/[pid]/limits
exit 1

- name: Collect Metrics
if: needs.changes.outputs.src == 'true' || github.event_name == 'workflow_dispatch'
id: collect-gha-metrics
Expand Down Expand Up @@ -585,6 +600,11 @@ jobs:
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ""
- name: DEBUG Get Resource file
uses: actions/upload-artifact@v3
with:
name: resource.log
path: output/output.txt
# Run this step when changes that do not need the test to run are made
- name: Run Setup
if: needs.changes.outputs.src == 'false'
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/docker/test_env/cl_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ func (n *ClNode) StartContainer() error {
return err
}

cReq, err := n.getContainerRequest(nodeSecretsToml)
cReq, err := n.GetContainerRequest(nodeSecretsToml)
if err != nil {
return err
}
Expand Down Expand Up @@ -381,7 +381,7 @@ func (n *ClNode) ExecGetVersion() (string, error) {
return "", errors.Errorf("could not find chainlink version in command output '%'", output)
}

func (n *ClNode) getContainerRequest(secrets string) (
func (n *ClNode) GetContainerRequest(secrets string) (
*tc.ContainerRequest, error) {
configFile, err := os.CreateTemp("", "node_config")
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ require (
github.com/rs/zerolog v1.30.0
github.com/scylladb/go-reflectx v1.0.1
github.com/segmentio/ksuid v1.0.4
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/slack-go/slack v0.12.2
github.com/smartcontractkit/chainlink-automation v1.0.2-0.20240118014648-1ab6a88c9429
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240205180946-df826cb540ce
Expand Down Expand Up @@ -362,7 +363,6 @@ require (
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
github.com/sercand/kuberesolver/v5 v5.1.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/shirou/gopsutil/v3 v3.23.11 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
Expand Down
58 changes: 58 additions & 0 deletions integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ import (
"fmt"
"math/big"
"net/http"
"os"
"path/filepath"
"runtime"
"testing"
"time"

"github.com/shirou/gopsutil/cpu"
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink-testing-framework/logging"
Expand All @@ -23,6 +27,60 @@ import (
// Tests a basic OCRv2 median feed
func TestOCRv2Basic(t *testing.T) {
t.Parallel()
// DEBUG: For monitoring GHA resources
workspace := os.Getenv("GITHUB_WORKSPACE") // Get the GitHub Actions workspace path
outputPath := filepath.Join(workspace, "output", "output.txt") // Specify a path within the workspace

// Ensure the directory exists
err := os.MkdirAll(filepath.Dir(outputPath), os.ModePerm)
if err != nil {
panic(err)
}
resourcesFile, err := os.OpenFile(outputPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() {
resourcesFile.Close()
})

go func() {
_, err := resourcesFile.WriteString("Started Monitoring\n")
if err != nil {
t.Log(err)
}
for {
var m runtime.MemStats
runtime.ReadMemStats(&m)

_, err := resourcesFile.WriteString(fmt.Sprintf("%s | Alloc = %v MiB", time.Now().String(), m.Alloc/1024/1024))
if err != nil {
t.Log(err)
}
_, err = resourcesFile.WriteString(fmt.Sprintf("\tTotalAlloc = %v MiB", m.TotalAlloc/1024/1024))
if err != nil {
t.Log(err)
}
_, err = resourcesFile.WriteString(fmt.Sprintf("\tSys = %v MiB", m.Sys/1024/1024))
if err != nil {
t.Log(err)
}
_, err = resourcesFile.WriteString(fmt.Sprintf("\tNumGC = %v\n", m.NumGC))
if err != nil {
t.Log(err)
}
percentages, err := cpu.Percent(1*time.Second, false)
if err != nil {
fmt.Printf("Error retrieving CPU usage: %s\n", err)
return
}
_, err = resourcesFile.WriteString(fmt.Sprintf("%s | CPU Usage: %.2f%%\n", time.Now().String(), percentages[0]))
if err != nil {
t.Log(err)
}
time.Sleep(time.Second)
}
}()

noMedianPlugin := map[string]string{string(env.MedianPlugin.Cmd): ""}
medianPlugin := map[string]string{string(env.MedianPlugin.Cmd): "chainlink-feeds"}
Expand Down
Loading