It will use docker-copose.test.yaml
and Dockerfile.test
to run integration tests.
Run following command to run integration test using docker.
-
docker-compose -f docker-compose.test.yaml up --build --abort-on-container-exit --force-recreate
- OR using make:
make docker-verify
- OR using make:
- At root of project, run
docker-compose up
ordocker-compose up -d
in detach mode.- OR using make:
make docker-run
- OR using make:
- Note: Recreate volumes if database is not created in container while docker up:
docker-compose up -V
How to set up and run locally without docker.
- Golang version 1.6 and above
- Postgres version 14 and above
- Install mockery v2 latest version as per doc
- Required for generating mocks from interfaces for writing new unit tests.
- Not needed to run application
- Make changes to
.env
values as per your config and requirements. - Setup Database
- For first time, create a postgres database and put credentials in
.env
file. - Also create table using
./data/init_database.sql
- For first time, create a postgres database and put credentials in
- Verify setup by running integration tests
go test ./integration_tests/ -tags=integration
- OR run
make integration-test
- OR run
- Run application from root
go run main.go
- OR
make run
- OR
go build -o wager-app
ORmake build
./wager-app
./
Root
./main.go
: entry point for app../app_errors/
: errors/error codes communicated to outside world../dto/
: data transfer objects communicated to outside world../data/
: data resources for app. Ex initial db data, migrations etc../integration_tests/
: integration tests to verify sanity of app in any environment. Build/deployment should not happen on failure./internal/
: packages within app scope and should not be exposed to outside../internal/config/
: app configurations and related operations../internal/db/
: database related operations../internal/handlers/
: rest request handlers../internal/integrations/
: other services/3rd party integrations../internal/services/
: service layer to handle business logic.