Repository navigation
[Load Tests] Added load testing foundation and markdown file guide #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9c278d6
Updated run_local_isolated script to use the Supabase CLI installed i…
O-Bots 23c377b
Updated the running the app section of README.md, to be easier to und…
O-Bots 5e72f4f
This commit is for adding load test func
O-Bots d231237
Implement retry logic in `fetch-media` to handle transient connection…
MartinBraquet 67758df
Improvements
MartinBraquet 11e4245
Increase max acceptable p95 latency threshold in test script from 800…
MartinBraquet 4fffc2d
Add `AbortSignal` to ESLint globals; increase max p95 latency thresho…
MartinBraquet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: Load test (full) | ||
|
|
||
| # The full load test against the dev API, once a week: 100 users for 120 seconds. | ||
| # 100 users is Firebase's limit of 100 new accounts per hour from one IP address. Raising it needs a | ||
| # higher sign-up quota in the Firebase console first. | ||
| on: | ||
| schedule: | ||
| - cron: '0 6 * * 1' # Mondays at 06:00 UTC | ||
| workflow_dispatch: # adds a "Run workflow" button in the Actions tab | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| full: | ||
| uses: ./.github/workflows/load-test.yml | ||
| with: | ||
| users: 100 | ||
| duration: 120 | ||
| max_error_rate: 1 | ||
| max_p95: 1200 | ||
| report_name: load-full-report |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Load test (smoke) | ||
|
|
||
| # A small JMeter run when a pull request changes API-related files, to check the test plan still works. | ||
| # It tests the API deployed to dev, not the pull request's code: dev is only updated by running | ||
| # backend/api/deploy-api.sh dev by hand. The weekly full run is in load-full-test.yml. | ||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'backend/api/**' | ||
| - 'backend/shared/**' | ||
| - 'common/src/api/**' | ||
| - 'tests/load/**' | ||
| - '.github/workflows/load-*.yml' | ||
| workflow_dispatch: # adds a "Run workflow" button in the Actions tab | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| smoke: | ||
| uses: ./.github/workflows/load-test.yml | ||
| with: | ||
| users: 3 | ||
| duration: 30 | ||
| max_error_rate: 0 | ||
| max_p95: 2000 | ||
| report_name: load-smoke-report |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| name: Load test | ||
|
|
||
| # The steps shared by the smoke and full load tests. It doesn't run on its own: load-smoke-test.yml and | ||
| # load-full-test.yml call it with their own settings. See docs/load-testing.md. | ||
| # | ||
| # It tests the API deployed to dev (the plan's default apiHost), not the code in this checkout. | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| users: | ||
| description: Threads for account creation and the load test (one account each) | ||
| type: number | ||
| required: true | ||
| duration: | ||
| description: Seconds the load test runs | ||
| type: number | ||
| required: true | ||
| max_error_rate: | ||
| description: Highest error rate allowed for any request, in percent | ||
| type: number | ||
| required: true | ||
| max_p95: | ||
| description: Highest p95 response time allowed for TEST requests, in milliseconds | ||
| type: number | ||
| required: true | ||
| report_name: | ||
| description: Name of the uploaded report artifact | ||
| type: string | ||
| required: true | ||
|
|
||
| env: | ||
| JMETER_VERSION: '5.6.3' | ||
| PLAN: compass-testPlan.jmx | ||
| USERS: ${{ inputs.users }} | ||
| DURATION: ${{ inputs.duration }} | ||
| MAX_ERROR_RATE: ${{ inputs.max_error_rate }} | ||
| MAX_P95: ${{ inputs.max_p95 }} | ||
|
|
||
| jobs: | ||
| load-test: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| # GitHub keeps only one pending run per concurrency group and cancels the one it replaces, so a single | ||
| # shared group would let a PR push silently cancel a queued run of another PR or the weekly full run. | ||
| # Instead each PR gets its own smoke group, where a newer push replaces the older run (its accounts are | ||
| # still deleted by the cleanup step, which runs on cancel), and the full run gets a group of its own. | ||
| # Smoke runs use only a few users, so one overlapping another run barely skews its results. | ||
| concurrency: | ||
| group: load-test-${{ inputs.report_name }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
| defaults: | ||
| run: | ||
| working-directory: tests/load # folder holding the .jmx and check_results.py | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: '17' | ||
|
|
||
| - name: Cache JMeter | ||
| id: jmeter-cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/jmeter | ||
| key: jmeter-${{ env.JMETER_VERSION }} | ||
|
|
||
| - name: Install JMeter | ||
| if: steps.jmeter-cache.outputs.cache-hit != 'true' | ||
| run: | | ||
| cd "$HOME" | ||
| base="https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz" | ||
| curl -fsSLO "$base" | ||
| # make sure the download wasn't corrupted or tampered with | ||
| echo "$(curl -fsSL "$base.sha512" | cut -d' ' -f1) apache-jmeter-${JMETER_VERSION}.tgz" | sha512sum -c - | ||
| mkdir -p jmeter | ||
| tar -xzf "apache-jmeter-${JMETER_VERSION}.tgz" -C jmeter --strip-components=1 | ||
|
|
||
| - name: Add JMeter to PATH | ||
| run: echo "$HOME/jmeter/bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Run load test | ||
| id: jmeter | ||
| run: | | ||
| mkdir -p results | ||
| # The plan puts the run ID in each account's email and username. The run ID and attempt number keep | ||
| # them unique, including when a failed job is re-run. | ||
| jmeter -n -t "$PLAN" -JrunId="${GITHUB_RUN_ID: -5}${GITHUB_RUN_ATTEMPT}" \ | ||
| -JsetupThreads="$USERS" -Jthreads="$USERS" -Jduration="$DURATION" \ | ||
| -l results/results.jtl -j jmeter.log -e -o report | ||
|
|
||
| - name: Check results | ||
| run: python3 check_results.py results/results.jtl --max-error-rate "$MAX_ERROR_RATE" --max-p95 "$MAX_P95" | ||
|
|
||
| # tearDown normally deletes the accounts. This only runs if JMeter crashed or the job was cancelled. | ||
| - name: Clean up accounts if the test didn't finish | ||
| if: always() && steps.jmeter.outcome != 'success' | ||
| run: | | ||
| [ -s created_accounts.txt ] || { echo "No accounts to clean up"; exit 0; } | ||
| jmeter -n -t "$PLAN" \ | ||
| -JcheckLeftovers=0 -JsetupThreads=0 -Jthreads=0 \ | ||
| -l results/cleanup.jtl -j cleanup.log | ||
|
|
||
| - name: Save report | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ inputs.report_name }} | ||
| path: | | ||
| tests/load/report | ||
| tests/load/results | ||
| tests/load/errors.xml | ||
| tests/load/jmeter.log | ||
| tests/load/cleanup.log | ||
| if-no-files-found: ignore |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: CompassConnections/Compass
Length of output: 12325
Correct the isolated setup synchronization claim.
yarn test:db:resetseeds database users beforedev:isolatedstarts Firebase. If Firebase is unavailable, the seed creates database-only users. The README therefore cannot promise that resetting the database keeps Firebase and the database in sync.This does not prevent the documented user from signing up and browsing synthetic profiles, but it makes seeded users unsuitable for flows that require sign-in. Update the README to state this limitation, or change the launcher and setup lifecycle so Firebase is running before seeding. Do not add a second
yarn emulatecommand without coordinating process ownership, becausedev:isolatedalready starts Firebase and could cause port conflicts.🤖 Prompt for AI Agents