-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
57 additions
and
2 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,54 @@ | ||
# Load-testing for projects backend | ||
|
||
## Setup | ||
|
||
Open a shell in the load-testing directory and execute the following actions: | ||
|
||
### Create a virtual environment | ||
|
||
```bash | ||
python3 -m venv .venv | ||
``` | ||
|
||
### Activate the virtual environment | ||
|
||
```bash | ||
source .venv/bin/activate | ||
``` | ||
|
||
### Install the required packages | ||
|
||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
## Configuration | ||
|
||
- Choose the host and the number of users in the `locust.conf` file. | ||
- Choose the tested endpoints in the `locustfile.py` file. | ||
|
||
|
||
## Usage | ||
|
||
### Retrieve the token | ||
|
||
You need the client secret for the `projects-frontend-dev` Keycloak client. | ||
|
||
Run the followin command : | ||
```bash | ||
CLIENT_SECRET=${CLIENT_SECRET} locust | ||
``` | ||
Then click on the output link, this will open a browser window. This will redirect you instantly. Copy the url you have been redirected to, paste it in the terminal, and press enter. | ||
|
||
You can now copy the token that has been displayed in the browser window (don't forget the equal signs at the end). | ||
|
||
### Start locust using the token | ||
|
||
Run the following command : | ||
```bash | ||
CLIENT_SECRET=${CLIENT_SECRET} TOKEN="${TOKEN}" locust | ||
``` | ||
|
||
Then click on the link displayed in the terminal to open the locust web interface. | ||
|
||
You can now run the tests. |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
host = https://api-ref.projects.k8s.lp-i.dev | ||
# host = https://api-ref.projects.k8s.lp-i.dev | ||
host = "https://cri.projects.k8s.lp-i.dev" | ||
users = 5 | ||
spawn-rate = 1 | ||
run-time = 10m |
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