|
| 1 | +# UID2 Operator Performance Testing Tool |
| 2 | +The following instructions will work for any operator. |
| 3 | + |
| 4 | +## Steps |
| 5 | +### Step 1 - Configure the K6 script |
| 6 | +The script as checked in has a basic config that will run a check against all endpoints. |
| 7 | + |
| 8 | + |
| 9 | +All the manual config can be changed at the top of the script. |
| 10 | + |
| 11 | +To change/remove scenarios modify the options.scenarios. For information on configuring k6 scenarios see https://k6.io/docs/using-k6/scenarios/. |
| 12 | + |
| 13 | +The variable `testDurationInSeconds` must be greater than the total duration of the test you are running. |
| 14 | +Any of the `*Tests` booleans can be set false if you are not running tests for that endpoint, this will save memory and start up time. |
| 15 | +### Step 2 - Execute K6 Script |
| 16 | +#### Option 2a - Execute K6 Script Locally (uid2-dev-workspace) |
| 17 | +If you would like to test locally, follow these steps: |
| 18 | +1. Pull the K6 Docker image: `docker pull grafana/k6` |
| 19 | +2. Execute the K6 script |
| 20 | + * PowerShell/Bash: |
| 21 | + ``` |
| 22 | + cat k6-uid2-operator.js ` |
| 23 | + | docker run --network="host" --rm -i ` |
| 24 | + -e CLIENT_KEY="<client_key>" ` |
| 25 | + -e CLIENT_SECRET="<client_secret>" ` |
| 26 | + -e BASE_URL="<operator_endpoint>" ` |
| 27 | + grafana/k6 run - |
| 28 | + ``` |
| 29 | +
|
| 30 | +#### Option 2b - Execute K6 Script in K8s |
| 31 | +In order to reduce network latency, we should deploy k6 and its script with the same zone of UID2 operator. |
| 32 | +
|
| 33 | +Set environment variables `CLIENT_KEY`, `CLIENT_SECRET`, `BASE_URL` and then use k6 to execute the testing by following command. |
| 34 | +``` |
| 35 | +k6 run k6-uid2-operator.js -e CLIENT_KEY=$CLIENT_KEY -e CLIENT_SECRET=$CLIENT_SECRET -e BASE_URL=$BASE_URL -e REFRESH_TOKEN=$REFRESH_TOKEN |
| 36 | +``` |
| 37 | +
|
0 commit comments