voting-service

Форк
0

README.MD

Voting REST service test task

Java CI with Maven Coverage Branches

Prerequisites

  • Maven 3
  • JDK 21
  • K6 (install according to manual)

Implement Voting REST service with next operations

  • Get candidates (should be read from JSON file during app start)
  • Make vote (by passport id) (no double vote allowed)
  • Get voting results

How to build

mvn clean install

How to start

Use run.bat script in project root folder or use docker-compose:

docker-compose up

Swagger documentation page

http://localhost:8090/swagger-ui/index.html

Useful CURL commands

Get candidates

curl http://localhost:8090/candidates

Get voting results

curl http://localhost:8090/votings

Get voting results for particular candidate

curl http://localhost:8090/votings/3

Make vote

curl -i -X POST http://localhost:8090/votings/3 \
-H "Content-Type: application/json" \
-d "{ \"passportId\": \"MP345353634547\"}"

Delete voting results

curl -i -X DELETE http://localhost:8090/votings

How to run Spock-based functional tests

cd func-tests
./gradlew clean build

Check tests report at ./func-tests/build/spock-reports/index.html

How to run k6-based performance tests (with console output)

cd load-tests
k6 run script.js

How to run k6-based performance tests (with Grafana visualization)

Start InfluxDB and Grafana (according to https://k6.io/blog/k6-loves-grafana/)

git clone https://github.com/grafana/k6 && cd k6
git submodule update --init
docker-compose up -d influxdb grafana

Grafana available via http://localhost:3000

Add datasource with next params:

URL: http://localhost:8086
Access: Browser
Database: mydb
HTTP Method: GET

Run load test with sending data to Grafana

k6 run -o influxdb=http://localhost:8086/mydb script.js

Import dashboard to Grafana from file ./load-tests/k6-grafana-dashboard.json and get results

K6 Grafana dashboard

Описание

Voting service test task

Языки

Java

  • JavaScript
  • Dockerfile
  • Batchfile
  • Groovy
Сообщить о нарушении

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.