Skip to content

Commit

Permalink
Add integration tests. Remove docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
mgerasimchuk committed Oct 26, 2023
1 parent 0529fc6 commit ea79828
Show file tree
Hide file tree
Showing 8 changed files with 266 additions and 46 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ logs-verifier:
docker-compose -f ${DOCKER_COMPOSE_FILENAME} logs -f verifier
test:
docker run -v $(shell pwd):/app golang:1.20.0 /bin/bash -c 'cd /app && GO111MODULE=on go test -mod vendor -covermode=count -coverprofile=assets/coverage/coverage.out -v ./... && go tool cover -html=assets/coverage/coverage.out -o=assets/coverage/coverage.html'
test-integration-api:
docker-compose -f ${DOCKER_COMPOSE_FILENAME} run test-integration-api
lint-architecture:
docker run --rm -v $(shell pwd):/app -w /app golang:1.20.0 /bin/bash -c "go install github.com/fdaines/[email protected] && arch-go -v"
vendor-install:
Expand Down
19 changes: 13 additions & 6 deletions deployments/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ version: '3.4'

services:
api:
build:
context: ./../..
dockerfile: ./docker/api/Dockerfile
image: golang:1.20.0
restart: "no"
env_file:
- ./../../deployments/docker-compose/.env
Expand All @@ -16,9 +14,7 @@ services:
- "8080:8080"
entrypoint: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; go run /app/cmd/api/main.go'
verifier:
build:
context: ./../..
dockerfile: ./docker/verifier/Dockerfile
image: golang:1.20.0
restart: "no"
env_file:
- ./../../deployments/docker-compose/.env
Expand Down Expand Up @@ -78,3 +74,14 @@ services:
CONSTRAINT pk_booking_id PRIMARY KEY ( id )
);
"'
# integration tests (manual start)
test-integration-api:
image: golang:1.20.0
profiles:
- donotstart
working_dir: /app
environment:
SERVER_URL: "http://api:8080"
volumes:
- ./../../:/app
entrypoint: "/bin/bash -c 'go test -count=1 -v ./test/integration/api'"
17 changes: 0 additions & 17 deletions docker/api/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions docker/verifier/Dockerfile

This file was deleted.

36 changes: 32 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ go 1.20

require (
github.com/brianvoe/gofakeit/v6 v6.5.0
github.com/bxcodec/faker/v3 v3.8.1
github.com/gavv/httpexpect/v2 v2.16.0
github.com/gin-gonic/gin v1.7.2
github.com/golang/mock v1.5.0
github.com/google/uuid v1.3.0
Expand All @@ -17,28 +19,54 @@ require (
)

require (
github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hpcloud/tail v1.0.0 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/klauspost/compress v1.15.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/lib/pq v1.1.1 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sanity-io/litter v1.5.5 // indirect
github.com/sergi/go-diff v1.0.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.34.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.7.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
moul.io/http2curl/v2 v2.3.0 // indirect
)
Loading

0 comments on commit ea79828

Please sign in to comment.