Skip to content

Commit

Permalink
feat: add soak test github action
Browse files Browse the repository at this point in the history
  • Loading branch information
sprutton1 committed Sep 9, 2024
1 parent 6a7671f commit d55db38
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/crons.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Crons

on:
schedule:
- cron: '*/15 * * * *' # Runs every 15 minutes
Expand All @@ -19,4 +21,4 @@ jobs:
uses: ./.github/workflows/run-api-test.yml
with:
environment: production
secrets: inherit
secrets: inherit
71 changes: 71 additions & 0 deletions .github/workflows/soak-test.yml
Original file line number Diff line number Diff line change
@@ -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 }} }'

0 comments on commit d55db38

Please sign in to comment.