Load Test for otel-collector on PR-1632 #152
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Load Test | |
# Trigger the test Manually additionally provide PR number. | |
on: | |
workflow_dispatch: | |
inputs: | |
pr_number: | |
description: 'Pull Request Number without "PR-" prefix' | |
required: true | |
image: | |
type: choice | |
options: | |
- otel-collector | |
- fluent-bit | |
- prometheus | |
- logs-otel | |
description: "Image to test" | |
required: true | |
duration: | |
type: string | |
description: "Duration of the test in seconds" | |
required: true | |
default: "1200" | |
run-name: "Load Test for ${{ inputs.image }} on PR-${{ inputs.pr_number }}" | |
env: | |
IMG: europe-docker.pkg.dev/kyma-project/dev/telemetry-manager:PR-${{ github.event.inputs.pr_number }} | |
jobs: | |
prepare-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- id: set-matrix | |
run: | | |
image=${{ github.event.inputs.image }} | |
matrix=$(jq --arg image "$image" 'map( . | select (.image==$image) )' hack/load-tests/matrix_includes.json) | |
echo "matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT | |
load-test: | |
needs: prepare-matrix | |
strategy: | |
fail-fast: false | |
max-parallel: 4 | |
matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Test | |
run: echo "input = ${{ github.event.inputs.image }}, matrix = ${{ matrix.image }}" | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
ref: "refs/pull/${{ github.event.inputs.pr_number }}/head" | |
repository: ${{ github.repository }} | |
- name: Setup Golang | |
uses: "./.github/template/setup-golang" | |
- name: Setup gardener cluster name | |
run: | | |
ID=$(echo ${{ github.run_id }}${{ github.run_attempt }} | rev ) | |
SHORT_NAME=$(echo ${{ matrix.name }} | awk -F- '{for(i=1;i<=NF;i++) printf "%s",substr($i,1,1);print "";}') | |
GARDENER_CLUSTER_NAME=$(echo lt-${SHORT_NAME}-${ID} | cut -c 1-14) | |
echo "GARDENER_CLUSTER_NAME=$GARDENER_CLUSTER_NAME" >> $GITHUB_ENV | |
# save gardener kubeconfig to a temp file in order to pass it to the command | |
- name: Save service account to file | |
shell: bash | |
run: 'echo "$GARDENER_SA" > /tmp/gardener-sa.yaml' | |
env: | |
GARDENER_SA: ${{ secrets.GARDENER_SA }} | |
# provision cluster | |
- name: Provision Gardener | |
run: make provision-gardener | |
env: | |
GARDENER_SECRET_NAME: ${{ secrets.GARDENER_SECRET_NAME }} | |
GARDENER_PROJECT: ${{ secrets.GARDENER_PROJECT }} | |
GARDENER_SA_PATH: /tmp/gardener-sa.yaml | |
GARDENER_MIN_NODES: 2 | |
GARDENER_MAX_NODES: 2 | |
- name: Deploy Telemetry | |
run: hack/deploy-telemetry.sh | |
- name: Deploy Istio Module | |
run: hack/deploy-istio.sh | |
# Run the load test | |
- name: Run Load test | |
run: hack/load-tests/run-load-test.sh -n ${{ matrix.name }} -t ${{ matrix.type }} -m ${{ matrix.multi }} -b ${{ matrix.backpressure }} -d ${{ github.event.inputs.duration }} -o "${{ matrix.overlay }}" | |
- name: Upload Results | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: Results-${{ matrix.name }} | |
path: tests/*.json | |
- name: Deprovision Gardener | |
run: make deprovision-gardener | |
# always run the deprovision step, even if the previous steps failed | |
if: always() | |
env: | |
GARDENER_SA_PATH: /tmp/gardener-sa.yaml | |
print-results: | |
needs: load-test | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Download Results | |
uses: actions/download-artifact@v4 | |
- name: Print Results | |
run: | | |
ls -la | |
python3 hack/load-tests/convert-results.py Results-* |