This repository contains k6 scripts for stress testing Koha and Aspen Discovery.
You need k6 installed to run these tests.
Using Homebrew:
brew install k6Debian/Ubuntu:
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491B6C8DA84
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6The aspen_discovery.js script simulates user traffic on an Aspen Discovery interface. It searches for random words from words_alpha.txt, clicks on results, and navigates back.
k6 run aspen_discovery.jsYou can configure the test using the following environment variables:
| Variable | Description | Default |
|---|---|---|
URL |
The base URL of the Aspen Discovery instance. | http://aspen-discovery.localhost |
RESULTS_TO_CLICK |
The number of search results to interact with per search. | 5 |
VUS |
The number of Virtual Users to simulate. | 1 |
ITERATIONS |
The number of iterations to run per VU. | 1 |
Example:
k6 run -e URL=https://my-aspen-catalog.org -e RESULTS_TO_CLICK=3 aspen_discovery.jsThe koha.js script simulates staff activity on the Koha staff interface and OPAC searches. It performs the following actions:
- Logs in to the staff interface.
- Creates a stub patron, biblio, and item via the API.
- Checks the item in, checks it out to the patron, and checks it in again.
- Performs a search on the OPAC.
- Deletes the created test data.
k6 run koha.js| Variable | Description | Default |
|---|---|---|
STAFF_URL |
The URL of the Koha staff interface. | http://kohadev-intra.localhost |
OPAC_URL |
The URL of the Koha OPAC. | http://kohadev.localhost |
STAFF_USER |
The username for the staff interface login. | koha |
STAFF_PASS |
The password for the staff interface login. | koha |
VUS |
The number of Virtual Users to simulate. | 1 |
ITERATIONS |
The number of iterations to run per VU. | 1 |
Example:
k6 run -e STAFF_URL=http://staff.mylibrary.org -e STAFF_USER=admin -e STAFF_PASS=secret koha.js