-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (49 loc) · 1.72 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
STATICCHECK = $(GOPATH)/bin/staticcheck
# varaibles required to run the test suit using make only
# docker compose up has its own env vvars defined in compose file
export PSQL_USER=root
export PSQL_PASSWORD=password
export PSQL_HOST=0.0.0.0
export PSQL_PORT=5432
export API_HOST=http://localhost:8080
$(STATICCHECK):
go get honnef.co/go/tools/cmd/staticcheck
$(GODOC):
go get -v golang.org/x/tools/cmd/godoc
# used to load all dependecies
deps:
go mod download
# run this when you need to run the whole test suit
# does everything unit and integration statements do individually
test: test.unit test.integration
# run when you need only unit tests
# also generates test coverage results in test_results folder
test.unit: lint
go test ./f3client/... -run=^Test_Unit_ -v -coverprofile=./test_results/unitcover.out
# run only for integration tests
# has 5 sec sleep to allow for the containes and apis to start up
# Note : In case you are running this on windows change "sleep 5" to "timeout 5"
test.integration: deps lint | api.start
sleep 5
go test ./f3client/... -p 1 -run=^Test_Integration_ -v -coverprofile=./test_results/itcover.out
make api.stop
lint: fmt | $(STATICCHECK)
go vet ./f3client/...
$(STATICCHECK) ./f3client/...
fmt : deps
go fmt ./f3client/...
# use this to see the documetation for this pkg
doc :
$(GODOC)
godoc -http=:6060
api.start:
docker-compose -f docker-compose.test.yml up -d
api.stop:
docker-compose -f docker-compose.test.yml down --volumes
docker.cleanup:
docker-compose down
docker image rmi form3-client-go_accountapi_client
# use this to analyse the test coverage results in html format
test.cover:
go tool cover -html=./test_results/unitcover.out
go tool cover -html=./test_results/itcover.out