This repository was archived by the owner on May 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
65 lines (60 loc) · 1.89 KB
/
test-locust.yaml
File metadata and controls
65 lines (60 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Test Locust
on:
push:
paths:
- 'locust/**'
- '.github/workflows/test-locust.yaml'
- '.github/actions/*'
jobs:
test-locust:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
scandir: "locust/docker-entrypoint.sh"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: "latest"
install: true
- name: Build Image
uses: docker/build-push-action@v3
with:
context: ./locust
push: false
pull: true
load: true
tags: sf-locust-test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Setup Docker Network
run: |
docker network create --driver bridge sf-test
- name: Start Pushgateway
run: |
docker run --network sf-test --name pushgateway -d -p 9091:9091 prom/pushgateway
- name: Start Testapp
run: |
docker run --network sf-test --name testapp -d -p 8080:8080 --env DISABLE_TLS=true stormforger/testapp
- name: Run locust image
working-directory: locust
run: |
docker run \
--network sf-test \
-v ${PWD}/test:/test \
--env PUSHGATEWAY_URL=http://pushgateway:9091/metrics/job/sf_locust_test \
--env LOCUSTFILE=/test/locust.py \
--env HOST=http://testapp:8080 \
--env NUM_USERS=10 \
--env RUN_TIME=60 \
sf-locust-test
- name: Test metrics from Pushgateway
working-directory: locust
run: |
echo "Scraping metrics from Pushgateway..."
curl --no-progress-meter http://localhost:9091/api/v1/metrics > /tmp/metrics.json
echo "Testing against metrics..."
test "$(jq -r '.data[0].request_count.metrics[0].value' /tmp/metrics.json)" -gt "0"