-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Problem We want to run the k6 tests in CI so that they also function as semi-integration test system. Closes: #317 # Solution - Added a workflow for the k6 tests - Disabled one test I didn't want to get working without additional work. So added an issue for that: #344
- Loading branch information
Showing
34 changed files
with
2,566 additions
and
107 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: Load Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
determine-service-matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
services: ${{ steps.determine-matrix.outputs.changes }} | ||
steps: | ||
- name: Check Out Repo | ||
uses: actions/checkout@v4 | ||
- uses: dorny/paths-filter@v3 | ||
id: determine-matrix | ||
with: | ||
# Note, 'common' is for future use--when code is factored out into common libraries, | ||
# but it's set up here so that the workflow logic could be tested with it present | ||
filters: | | ||
common: | ||
- '*' | ||
- '.github/**' | ||
account: | ||
- '*' | ||
- '.github/**' | ||
- 'services/account/**' | ||
graph: | ||
- '*' | ||
- '.github/**' | ||
- 'services/graph/**' | ||
content-publishing: | ||
- '*' | ||
- '.github/**' | ||
- 'services/content-publishing/**' | ||
content-watcher: | ||
- '*' | ||
- '.github/**' | ||
- 'services/content-watcher/**' | ||
build: | ||
name: '[${{ matrix.service }}] Load Test' | ||
runs-on: ubuntu-latest | ||
needs: determine-service-matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
service: ${{ fromJson(needs.determine-service-matrix.outputs.services) }} | ||
exclude: | ||
- service: common | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
registry-url: 'https://registry.npmjs.org' | ||
cache-dependency-path: tools/ci-k6/package-lock.json | ||
- name: Install dependencies | ||
working-directory: tools/ci-k6 | ||
run: npm ci | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{secrets.DOCKERHUB_USERNAME}} | ||
password: ${{secrets.DOCKERHUB_TOKEN}} | ||
|
||
- name: Start Frequency | ||
run: | | ||
docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml up -d frequency | ||
sleep 5 | ||
- name: Generate Provider and Capacity | ||
working-directory: tools/ci-k6 | ||
run: npm run main | ||
|
||
# Just start the services we need... | ||
- name: Start All Services | ||
run: docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml up -d | ||
|
||
- name: Wait for API to be ready | ||
uses: cygnetdigital/[email protected] | ||
with: | ||
url: 'http://localhost:3000/readyz' | ||
responseCode: '200' | ||
timeout: 120000 | ||
interval: 2000 | ||
|
||
- name: Setup K6 | ||
uses: grafana/setup-k6-action@v1 | ||
- name: Run k6 Tests | ||
run: | | ||
for test_file in services/${{ matrix.service }}/k6-test/*.k6.js; do | ||
k6 run --no-color --quiet --no-usage-report "$test_file" || exit 1 | ||
done | ||
- name: Stop Docker Compose | ||
if: always() | ||
run: docker compose -f docker-compose.yaml -f docker-compose-k6.${{ matrix.service }}.yaml down |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json | ||
|
||
services: | ||
account-service-api: | ||
pull_policy: never | ||
build: | ||
context: . | ||
dockerfile: ./Docker/Dockerfile.account | ||
command: ['api'] | ||
ports: | ||
- 3000:3000 | ||
volumes: !reset [] | ||
depends_on: !override | ||
redis: | ||
condition: service_started | ||
ipfs: | ||
condition: service_healthy | ||
account-service-webhook: | ||
condition: service_healthy | ||
environment: | ||
PROVIDER_BASE_URL: 'http://account-service-webhook:3001/webhooks/account-service' | ||
WEBHOOK_BASE_URL: 'http://account-service-webhook:3001/webhooks' | ||
|
||
account-service-worker: | ||
pull_policy: never | ||
build: | ||
context: . | ||
dockerfile: ./Docker/Dockerfile.account | ||
command: ['worker'] | ||
volumes: !reset [] | ||
depends_on: !override | ||
- redis | ||
- ipfs | ||
environment: | ||
PROVIDER_BASE_URL: 'http://account-service-webhook:3001/webhooks/account-service' | ||
WEBHOOK_BASE_URL: 'http://account-service-webhook:3001/webhooks' | ||
|
||
account-service-webhook: | ||
image: rust:1.80.0 | ||
volumes: | ||
- ./services/account/rust-webhook-server:/app | ||
ports: | ||
- '3001:3001' | ||
command: sh -c "cd /app && cargo run" | ||
healthcheck: | ||
test: ['CMD', 'curl', '-f', 'http://127.0.0.1:3001/webhooks/health'] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
start_period: 40s | ||
networks: | ||
- amplica-gateway | ||
|
||
gateway-base: | ||
profiles: | ||
- skip | ||
content-publishing-service-worker: | ||
profiles: | ||
- skip | ||
content-publishing-service-api: | ||
profiles: | ||
- skip | ||
content-watcher-service: | ||
profiles: | ||
- skip | ||
graph-service-api: | ||
profiles: | ||
- skip | ||
graph-service-worker: | ||
profiles: | ||
- skip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json | ||
|
||
services: | ||
content-publishing-service-api: | ||
pull_policy: never | ||
build: | ||
context: . | ||
dockerfile: ./Docker/Dockerfile.content-publishing | ||
command: ['api'] | ||
ports: | ||
- 3000:3000 | ||
volumes: !reset [] | ||
depends_on: !override | ||
- redis | ||
- ipfs | ||
|
||
content-publishing-service-worker: | ||
pull_policy: never | ||
build: | ||
context: . | ||
dockerfile: ./Docker/Dockerfile.content-publishing | ||
command: ['worker'] | ||
volumes: !reset [] | ||
depends_on: !override | ||
- redis | ||
- ipfs | ||
|
||
gateway-base: | ||
profiles: | ||
- skip | ||
account-service-worker: | ||
profiles: | ||
- skip | ||
account-service-api: | ||
profiles: | ||
- skip | ||
content-watcher-service: | ||
profiles: | ||
- skip | ||
graph-service-api: | ||
profiles: | ||
- skip | ||
graph-service-worker: | ||
profiles: | ||
- skip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json | ||
|
||
services: | ||
content-watcher-service: | ||
pull_policy: never | ||
build: | ||
context: . | ||
dockerfile: ./Docker/Dockerfile.content-watcher | ||
ports: | ||
- 3000:3000 | ||
volumes: !reset [] | ||
depends_on: !override | ||
- redis | ||
- ipfs | ||
|
||
gateway-base: | ||
profiles: | ||
- skip | ||
content-publishing-service-worker: | ||
profiles: | ||
- skip | ||
content-publishing-service-api: | ||
profiles: | ||
- skip | ||
account-service-worker: | ||
profiles: | ||
- skip | ||
account-service-api: | ||
profiles: | ||
- skip | ||
graph-service-api: | ||
profiles: | ||
- skip | ||
graph-service-worker: | ||
profiles: | ||
- skip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json | ||
|
||
services: | ||
graph-service-api: | ||
pull_policy: never | ||
build: | ||
context: . | ||
dockerfile: ./Docker/Dockerfile.graph | ||
command: ['api'] | ||
ports: | ||
- 3000:3000 | ||
volumes: !reset [] | ||
depends_on: !override | ||
- redis | ||
|
||
graph-service-worker: | ||
pull_policy: never | ||
build: | ||
context: . | ||
dockerfile: ./Docker/Dockerfile.graph | ||
command: ['worker'] | ||
volumes: !reset [] | ||
depends_on: !override | ||
- redis | ||
|
||
gateway-base: | ||
profiles: | ||
- skip | ||
content-publishing-service-worker: | ||
profiles: | ||
- skip | ||
content-publishing-service-api: | ||
profiles: | ||
- skip | ||
content-watcher-service: | ||
profiles: | ||
- skip | ||
account-service-api: | ||
profiles: | ||
- skip | ||
account-service-worker: | ||
profiles: | ||
- skip |
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
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
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
Oops, something went wrong.