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
Open
O-Bots
wants to merge
3
commits into
CompassConnections:main
Choose a base branch
from
O-Bots:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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: 800 | ||
| 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,122 @@ | ||
| 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 | ||
| # Never run two load tests at once: they hit the same dev API, so each would skew the other's results. | ||
| concurrency: | ||
| group: load-test | ||
| cancel-in-progress: false | ||
| 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: Make test accounts for this run | ||
| run: | | ||
| # one row per user: email,password,username,name (no header, no commas inside values) | ||
| # The run ID and attempt number make the accounts unique, including when a failed job is re-run. | ||
| id="${GITHUB_RUN_ID: -5}${GITHUB_RUN_ATTEMPT}" | ||
| rm -f accounts.csv | ||
| for i in $(seq 1 "$USERS"); do | ||
| echo "loadTest${id}x${i}@example.com,$(openssl rand -hex 8),loadUser${id}x${i},load Name${id}x${i}" >> accounts.csv | ||
| done | ||
| echo "Made $(wc -l < accounts.csv) accounts" | ||
|
|
||
| - name: Run load test | ||
| id: jmeter | ||
| run: | | ||
| mkdir -p results | ||
| jmeter -n -t "$PLAN" \ | ||
| -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" \ | ||
| -JresetFile=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
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