Skip to content

Go microservice that automates the process of assigning reviewers to Pull Requests in development teams

License

Notifications You must be signed in to change notification settings

anisimov-anthony/assignment-service

Repository files navigation

Assignment Service

Microservice for automatically assigning reviewers to Pull Requests.

Technology Stack

  • Language: Go 1.22
  • Database: MongoDB 7.0
  • HTTP Router: Gorilla Mux
  • Logging: Uber Zap
  • Testing: Go testing + testify
  • Containerization: Docker + Docker Compose

Quick Start

Running with Docker Compose

# Start all services
docker-compose up

## Convenient make commands (other commands can be found via make help)
# Stop and clean up
make docker-clean
# Start
make docker-up

The service will be available at http://localhost:8080

Note: If you already have a local MongoDB running on port 27017, Docker Compose will automatically use port 27018 for external access. Inside the Docker network, containers communicate via the standard port 27017.

Local Development

# Install dependencies
make deps

# Build and run
make run

# Or simply:
go run ./cmd/server

Makefile

Main commands (make help):

  • build Build binary
  • run Run application locally
  • test Run tests with race detector
  • test-coverage Show test coverage
  • lint Check code with golangci-lint
  • fmt Format code (go fmt + goimports)
  • verify Full check: format + linter + tests
  • clean Remove binaries and coverage
  • deps Download and clean up dependencies
  • docker-build Build Docker images
  • docker-up Start services
  • docker-up-detached Start services (in background)
  • docker-down Stop and remove containers
  • docker-clean Full cleanup: containers + volumes + images
  • docker-logs Follow container logs
  • help Show this help

API Endpoints

Main Endpoints (described in OpenAPI)

  • POST /team/add - create team
  • GET /team/get - get team information
  • POST /users/setIsActive - set user activity status
  • GET /users/getReview - get PRs assigned to user
  • POST /pullRequest/create - create Pull Request
  • POST /pullRequest/merge - set MERGED status for Pull Request
  • POST /pullRequest/reassign - reassign reviewer

Additionally Implemented Endpoints

  • GET /health - check service health (not described in OpenAPI, only declared)
  • GET /stats/user - user statistics

Testing

Code coverage: 87.5%

# Run all tests
make test

# View coverage
make test-coverage

Tests verify all main service scenarios including error handling and edge cases.

Load Testing

More details are described in scripts/k6/README.md

k6 is used for load testing. Tests are located in the scripts/k6/ folder:

Test results are saved to:

  • scripts/k6/results/ - text reports directly from the terminal with k6 runs
  • scripts/k6/k6-results/YYYY-MM-DD/ - JSON results for analysis (local folder)
  • scripts/k6/parse_results.py - script for parsing results

Testing Hardware

Load testing was performed on the following hardware:

Main specifications:

  • CPU: Intel i3-7020U (4 cores) @ 2.3GHz
  • RAM: 8GB
  • OS: Arch Linux x86_64

CI/CD

The project is configured with GitHub Actions:

  • go-ci.yml - building, testing and linting Go code
  • docker-ci.yml - building Docker images

License

This project is distributed under the MIT License.

About

Go microservice that automates the process of assigning reviewers to Pull Requests in development teams

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published