From d55db3888f28f98becd9dc6c8490e6be68919dfe Mon Sep 17 00:00:00 2001 From: Scott Prutton Date: Mon, 9 Sep 2024 16:34:38 -0400 Subject: [PATCH] feat: add soak test github action --- .github/workflows/crons.yml | 4 +- .github/workflows/soak-test.yml | 71 +++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/soak-test.yml diff --git a/.github/workflows/crons.yml b/.github/workflows/crons.yml index fd93031dd9..9b6f6f07c3 100644 --- a/.github/workflows/crons.yml +++ b/.github/workflows/crons.yml @@ -1,3 +1,5 @@ +name: Crons + on: schedule: - cron: '*/15 * * * *' # Runs every 15 minutes @@ -19,4 +21,4 @@ jobs: uses: ./.github/workflows/run-api-test.yml with: environment: production - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/soak-test.yml b/.github/workflows/soak-test.yml new file mode 100644 index 0000000000..393cd31ee1 --- /dev/null +++ b/.github/workflows/soak-test.yml @@ -0,0 +1,71 @@ +name: Soak Test +on: + workflow_dispatch: + inputs: + environment: + type: string + required: true + description: "where to test" + executors: + type: number + required: true + description: "number of instances of all tests to run" + maxDuration: + type: number + required: true + description: "how long to test for in seconds" + rate: + type: number + required: true + description: "time between tests in milliseconds" + test: + type: string + required: true + description: "which tests to run" + useJitter: + type: boolean + required: true + description: "insert random time of 0-1 seconds between test runs" + + +jobs: + define-test-matrix: + runs-on: ubuntu-latest + outputs: + executors: ${{ steps.executors.outputs.executors }} + steps: + - uses: actions/checkout@v4 + - id: executors + run: | + echo "executors=$(jq -n '[range(0; $num + 1)]' --argjson num ${{ inputs.executors }})" >> "$GITHUB_OUTPUT" + + api-test: + name: API Test SDF + environment: ${{ inputs.environment }} + runs-on: ubuntu-latest + needs: define-test-matrix + strategy: + # don't fail the entire matrix on failure + fail-fast: false + matrix: + tests: ${{ fromJSON(needs.define-test-matrix.outputs.executors) }} + env: + SDF_API_URL: ${{ vars.SDF_API_URL }} + AUTH_API_URL: ${{ vars.AUTH_API_URL }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + - name: Run the deno exec + run: | + cd bin/si-api-test + deno task run \ + --workspaceId ${{ vars.API_TEST_WORKSPACE_ID }} \ + --userId ${{ secrets.API_TEST_EMAIL }} \ + --password ${{ secrets.API_TEST_PASSWORD }} \ + --test ${{ inputs.tests }} \ + --profile '{"maxDuration":${{ inputs.maxDuration }}, "rate": ${{ inputs.rate }}, "useJitter": ${{ inputs.useJitter }} }' +