Skip to content

Commit

Permalink
Try monitoring resources
Browse files Browse the repository at this point in the history
  • Loading branch information
kalverra committed Feb 8, 2024
1 parent 08c7f17 commit d1a995e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,12 @@ jobs:
# pyroscope_env: ci-smoke-ocr-evm-simulated
- name: ocr2
nodes: 6
os: ubuntu20.04-32cores-128GB
os: ubuntu20.04-16cores-64GB
file: ocr2
pyroscope_env: ci-smoke-ocr2-evm-simulated
- name: ocr2
nodes: 6
os: ubuntu20.04-32cores-128GB
os: ubuntu20.04-16cores-64GB
pyroscope_env: ci-smoke-ocr2-plugins-evm-simulated
tag_suffix: "-plugins"
# - name: vrf
Expand Down Expand Up @@ -585,6 +585,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: resource.log
# 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
47 changes: 47 additions & 0 deletions integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import (
"fmt"
"math/big"
"net/http"
"os"
"runtime"
"testing"
"time"

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

"github.com/smartcontractkit/chainlink-testing-framework/logging"
Expand All @@ -23,6 +26,50 @@ import (
// Tests a basic OCRv2 median feed
func TestOCRv2Basic(t *testing.T) {
t.Parallel()
// DEBUG: For monitoring GHA resources
resourcesFile, err := os.OpenFile("resources.log", os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
t.Fatal(err)
}
defer resourcesFile.Close()

go func() {
_, err := resourcesFile.WriteString("Started Monitoring\n")
if err != nil {
t.Fatal(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.Fatal(err)
}
_, err = resourcesFile.WriteString(fmt.Sprintf("\tTotalAlloc = %v MiB", m.TotalAlloc/1024/1024))
if err != nil {
t.Fatal(err)
}
_, err = resourcesFile.WriteString(fmt.Sprintf("\tSys = %v MiB", m.Sys/1024/1024))
if err != nil {
t.Fatal(err)
}
_, err = resourcesFile.WriteString(fmt.Sprintf("\tNumGC = %v\n", m.NumGC))
if err != nil {
t.Fatal(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.Fatal(err)
}
time.Sleep(time.Second * 5)
}
}()

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

0 comments on commit d1a995e

Please sign in to comment.