Product service holds data about all known products. Product itself is a main artifact for sales and marketing departments, that may be active whether deactivated. Main operable entities: Product, Price, Currency, Discount.
This text provides instructions on how to set up and run performance tests for the product-service
using Docker and K6.
- Docker and Docker Compose installed on your machine.
- Basic understanding of Docker and performance testing concepts.
-
Environment Variables: Ensure that the necessary environment variables are set. These variables are used by the services defined in
docker-compose.yml
. These include:HOST
POSTGRES_DATABASE
POSTGRES_USERNAME
POSTGRES_PASSWORD
PGADMIN_EMAIL
PGADMIN_PASSWORD
You can set these variables in your environment or use a
.env
file at the root of your project. -
Build and Start Services: Use the following command to build and start the necessary services:
docker-compose up -d
This will start the
product-service
,postgres
,pgadmin
,influxdb
,grafana
,k6
, andprometheus
services as defined in yourdocker-compose.yml
.
-
K6 Script: Prepare your K6 script for performance testing. The script should be located in the
performance_scripts
directory as specified in thedocker-compose.yml
. -
Execute Test: To run the performance test, use the following command:
docker-compose run -e VUS=<number_of_virtual_users> k6 run /scripts/performance-tests-product-service.js
- Replace
<number_of_virtual_users>
with the desired number of virtual users for the test.
-
Grafana:
Grafana is set up to visualize the results. Access it athttp://localhost:3000
. Default login details are usuallyadmin/admin
. -
InfluxDB:
K6 sends the test results to InfluxDB, which Grafana uses as a data source. -
Prometheus:
Prometheus is used for monitoring; access it athttp://localhost:9090
.
- The performance test configuration can be adjusted in the K6 script.
- Ensure that all services in the
docker-compose.yml
are properly configured and running before executing the tests.