-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Locust examples (including distributed) (#6053)
* locust example * example workflows - locust and lucust distributed * updated after CR * typo fixed
- Loading branch information
1 parent
8f3f8de
commit f9adfc9
Showing
6 changed files
with
105 additions
and
0 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,72 @@ | ||
apiVersion: testworkflows.testkube.io/v1 | ||
kind: TestWorkflow | ||
metadata: | ||
name: locust-workflow-smoke | ||
labels: | ||
core-tests: workflows | ||
spec: | ||
content: | ||
git: | ||
uri: https://github.com/kubeshop/testkube | ||
revision: main | ||
paths: | ||
- test/locust/locust-project | ||
container: | ||
workingDir: /data/repo/test/locust/locust-project | ||
steps: | ||
- name: Run test | ||
run: | ||
image: locustio/locust:2.32.3 | ||
shell: | | ||
mkdir /data/artifacts | ||
locust -f locust_test.py --host https://testkube-test-page-lipsum.pages.dev/ --headless --users 6 --spawn-rate 3 --run-time 10s --html=/data/artifacts/report.html | ||
artifacts: | ||
paths: | ||
- "/data/artifacts/**" | ||
--- | ||
apiVersion: testworkflows.testkube.io/v1 | ||
kind: TestWorkflow | ||
metadata: | ||
name: distributed-locust-workflow-smoke | ||
labels: | ||
core-tests: workflows | ||
spec: | ||
config: | ||
workers: {type: integer, default: 2} | ||
content: | ||
git: | ||
uri: https://github.com/kubeshop/testkube | ||
revision: main | ||
paths: | ||
- test/locust/locust-project | ||
services: | ||
master: | ||
transfer: | ||
- from: /data/repo/test/locust/locust-project | ||
count: 1 | ||
timeout: 30s # initialization timeout | ||
logs: 'always' | ||
image: locustio/locust:2.32.3 | ||
shell: | | ||
mkdir /data/artifacts | ||
cd /data/repo/test/locust/locust-project | ||
locust --master -f locust_test.py --host https://testkube-test-page-lipsum.pages.dev/ --headless \ | ||
--users 20 --spawn-rate 10 --run-time 60s --stop-timeout 180 --html=/data/artifacts/report.html | ||
readinessProbe: | ||
tcpSocket: | ||
port: 5557 | ||
periodSeconds: 1 | ||
steps: | ||
- name: Run test | ||
parallel: | ||
count: 'config.workers' | ||
transfer: | ||
- from: /data/repo | ||
use: | ||
- name: distribute/evenly | ||
container: | ||
workingDir: /data/repo/test/locust/locust-project | ||
paused: true # synchronize running all workers - optional | ||
run: | ||
image: locustio/locust:2.32.3 | ||
shell: locust -f - --worker --master-host {{ services.master.0.ip }} --processes {{ config.workers }} |
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,6 @@ | ||
from locust import HttpUser, task | ||
|
||
class locust_example_test(HttpUser): | ||
@task | ||
def locust_example(self): | ||
self.client.get("/") |
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 @@ | ||
locust==2.32.3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: testworkflows.testkube.io/v1 | ||
kind: TestWorkflow | ||
metadata: | ||
name: locust-workflow-suite | ||
labels: | ||
core-tests: workflows-suite | ||
spec: | ||
steps: | ||
- execute: | ||
parallelism: 2 | ||
workflows: | ||
- name: locust-workflow-smoke | ||
- name: distributed-locust-workflow-smoke |