https://github.com/andrei-punko/voting-service
Voting service test task
https://github.com/andrei-punko/voting-service
spring-boot-application voting-application voting-service
Last synced: about 2 months ago
JSON representation
Voting service test task
- Host: GitHub
- URL: https://github.com/andrei-punko/voting-service
- Owner: andrei-punko
- License: mit
- Created: 2020-07-29T11:53:07.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-18T10:22:00.000Z (about 1 year ago)
- Last Synced: 2025-03-18T11:33:33.020Z (about 1 year ago)
- Topics: spring-boot-application, voting-application, voting-service
- Language: Java
- Homepage:
- Size: 483 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Voting REST service (test task)

[](https://github.com/andrei-punko/voting-service/actions/workflows/maven.yml)
[](https://github.com/andrei-punko/voting-service/actions/workflows/maven.yml)
## Prerequisites
- Maven 3
- JDK 21
- K6 for performance tests (install according to [manual](https://k6.io/docs/getting-started/installation))
## 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 project
mvn clean install
## How to start application
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
```bash
curl http://localhost:8090/candidates
```
### Get voting results
```bash
curl http://localhost:8090/votings
```
### Get voting results for particular candidate
```bash
curl http://localhost:8090/votings/3
```
### Make vote
```bash
curl -i -X POST http://localhost:8090/votings/3 \
-H "Content-Type: application/json" \
-d "{ \"passportId\": \"MP345353634547\"}"
```
### Delete voting results
```bash
curl -i -X DELETE http://localhost:8090/votings
```
## How to run Spock-based functional tests
```bash
cd func-test
./gradlew clean build
```
Check tests report at `./func-test/build/spock-reports/index.html`
## How to run k6-based performance tests
```bash
cd load-test
k6 run script.js
```
Check tests report in console
## YouTube video with description of the project refactoring
[Рефакторинг Spring Boot сервиса из тестового задания](https://youtu.be/esueccOEQZE)