Skip to content

Commit

Permalink
add locust support (#33)
Browse files Browse the repository at this point in the history
* add  locust support

* add requirements dev file

* update readme
  • Loading branch information
ioigoume authored Oct 26, 2023
1 parent 5108499 commit 05ee059
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ docker-compose pull

### Install python dependencies
docker-compose run --rm --no-deps web pip install --upgrade pip
docker-compose run --rm --no-deps web pip3 install --no-cache-dir -r requirements.txt
docker-compose run --rm --no-deps web pip3 install --no-cache-dir -r requirements_dev.txt

### Install nodejs dependencies
docker-compose run --rm --no-deps api npm install --prefer-online
Expand Down
17 changes: 17 additions & 0 deletions app/tests/locust.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from locust import HttpUser, task, between


class WebsiteUser(HttpUser):
# wait_time can be overridden for individual TaskSets
wait_time = between(10, 300)

# Host for locust interface: https://metrics-dev.rciam.grnet.gr
@task
def metrics_egi_devel_tenenv(self):
headers = {
'accept': 'application/json',
'x-tenant': 'egi',
'x-environment': 'devel'
}

self.client.get("/api/v1/tenenv/egi/devel", headers=headers)
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ services:
# - ./javascript/node_modules
tty: true

locust:
image: metricsrciam:latest
container_name: metrics.rciam.locust
command: locust -f app/tests/locust.py
ports:
- "8089:8089"
- "3100:3100"
volumes:
- .:/app
tty: true

volumes:
pgdata:

Expand Down
28 changes: 28 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
alembic==1.10.2
asgiref==3.5.2
asyncpg==0.28.0
click==8.1.3
fastapi==0.100.0
geoip2
h11==0.13.0
importlib-resources==5.7.1
Mako==1.2.0
MarkupSafe==2.1.1
psycopg2-binary==2.9.7
pydantic==1.10.7
PyGreSQL==5.2.5
SQLAlchemy==1.4.41
sqlalchemy2-stubs==0.0.2a32
sqlmodel==0.0.8
typer==0.4.1
typing_extensions==4.5.0
uvicorn==0.21.1
zipp==3.8.0
cachetools==5.3.0
Authlib==1.2.0
itsdangerous==2.1.2
httpx==0.23.3
pyjwt==2.7.0
geoip2==4.7.0
gunicorn==21.2.0
locust==2.17.0

0 comments on commit 05ee059

Please sign in to comment.