Skip to content

Commit

Permalink
feat: DEVOPS-1833 jmeter test pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlops committed Feb 4, 2025
1 parent 490ac28 commit b67a61f
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/test_performance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@ on:
push:
workflow_dispatch:
inputs:
network:
description: "Network"
type: choice
options:
- "devnet"
- "infratest"
- "perftest"
- "protomainnet"
- "prototestnet"
- "richard"
- "uccbtest"
required: false
default: "prototestnet"
target_host:
description: "Target host to test"
description: "Target host"
type: string
required: false
default: "query.zq2-prototestnet.zilliqa.com"
default: "api.zq2-prototestnet.zilliqa.com"
target_port:
description: "Target port"
type: string
Expand Down Expand Up @@ -53,12 +66,14 @@ jobs:
permissions:
id-token: write
contents: write
name: Performance tests
name: Jmeter test
runs-on: self-hosted
container:
image: alpine/jmeter:5.6
if: github.actor != 'dependabot[bot]'
timeout-minutes: 1440
env:
TEST_ID: "jmeter-test-zq2-${{ github.run_id }}"
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -76,7 +91,6 @@ jobs:
- name: Run tests
working-directory: infra/jmeter
run: |
export TEST_ID="jmeter-test-${GITHUB_REPOSITORY##*/}-${{ github.run_id }}"
export TARGET_HOST=${{ github.event.inputs.target_host || 'query.zq2-prototestnet.zilliqa.com' }}
export TARGET_PORT=${{ github.event.inputs.target_port || '443' }}
export PROTOCOL=${{ github.event.inputs.protocol || 'https' }}
Expand All @@ -97,7 +111,7 @@ jobs:
-JRESPONSE_TIMEOUT=${RESPONSE_TIMEOUT} \
-t jmeter-plan-template.jmx \
-l ${TEST_ID}.jtl \
-o reports
-o ${TEST_ID}
echo "Test results for ${TEST_ID}:"
cat "${TEST_ID}.jtl"
Expand All @@ -107,11 +121,12 @@ jobs:
with:
token_format: "access_token"
workload_identity_provider: ${{ secrets.GCP_PRD_GITHUB_WIF }}
service_account: "${{ secrets.GCP_PRD_GITHUB_SA_K8S_DEPLOY }}"
service_account: "${{ secrets.GCP_PRD_GITHUB_SA_TESTING }}"
create_credentials_file: true

- name: Upload reports
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: infra/jmeter/reports
destination: 'zq2-infratest-checkpoint'
process_gcloudignore: false
path: "infra/jmeter/${{ env.TEST_ID }}"
destination: "zq2-${{ github.event.inputs.network || 'infratest' }}-performance-tests"
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ Then you can install a suitable Solc version by executing:
svm install <solc version>
```

### Tests with JMeter

JMeter for performance and load tests is integrated in the Github Action pipelines in `.github/workflows/test_performance.yaml` and can be manually executed from the Github console with custom and default parameters. The test executions are restricted to users of the Zilliqa organization.

## Running benchmarks

Benchmarks can be run with `cargo bench --package zilliqa --bench it`.
Expand All @@ -104,6 +108,23 @@ Or via individual modules using eg.
RUST_LOG=debug,sled=info,zilliqa::scilla=trace
```

## Observability

### OpenTelemetry

OpenTelemetry metrics from the Zilliqa nodes container are available when the OTLP collector endpoint is defined in the configuration.

```yaml
otlp_collector_endpoint = "http://otel-collector:4317"
```

There is a docker-compose project that includes the OpenTelemetry configuration and tech stack that can be run in local environment for testing purposes:

```bash
cd infra/opentelemetry
docker-compose up
```

## `rustfmt`

We use a couple of nightly-only rustfmt features. The easiest way to get these is:
Expand Down
48 changes: 48 additions & 0 deletions infra/tf/testing.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
################################################################################
# PERFORMANCE TESTS BUCKET
################################################################################

resource "google_storage_bucket" "performance_tests" {
name = join("-", compact([var.chain_name, "performance-tests"]))
project = var.project_id
location = var.region
labels = local.labels

force_destroy = var.persistence_bucket_force_destroy
uniform_bucket_level_access = true
public_access_prevention = "inherited"

versioning {
enabled = false
}

lifecycle_rule {
action {
type = "SetStorageClass"
storage_class = "NEARLINE"
}
condition {
age = 7
}
}

lifecycle_rule {
action {
type = "SetStorageClass"
storage_class = "COLDLINE"
}
condition {
age = 37 # 7 days in Standard + 30 days in Nearline
}
}

lifecycle_rule {
action {
type = "SetStorageClass"
storage_class = "ARCHIVE"
}
condition {
age = 127 # 37 days + 90 days in Coldline
}
}
}

0 comments on commit b67a61f

Please sign in to comment.