-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.testing
58 lines (42 loc) · 1.86 KB
/
Makefile.testing
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
COVERPROFILE ?= coverage.out
TEST_LOG_FILENAME ?= autotest.log
ARTIFACTS_DIR = .artifacts
TEST_COUNT ?= 1
TEST_ARGS ?=
##@ Testing
.PHONY: unit
unit: ## run unit tests
go test -v ./... -tags unit -count $(TEST_COUNT) -race $(TEST_ARGS)
.PHONY: test
test: unit integration test-heavy-mock-integration ## run all tests
.PHONY: integration
integration: ## run integrations tests with race
go test -v ./... -tags integration -count $(TEST_COUNT) -race $(TEST_ARGS)
.PHONY: test-with-coverage
test-with-coverage: ## run tests with coverage mode
go-acc --covermode=count --output=coverage.tmp.out ./... -- -tags "unit integration heavy_mock_integration" -count=1
cat coverage.tmp.out | grep -v _mock.go > ${COVERPROFILE}
go tool cover -html=${COVERPROFILE} -o coverage.html
.PHONY: test-heavy-mock-integration
test-heavy-mock-integration:
bash -c "set -o pipefail && go test -v ./... -tags heavy_mock_integration -count $(TEST_COUNT) -race $(TEST_ARGS) | tee $(TEST_LOG_FILENAME)"
##@ Benchmarks
.PHONY: bench
bench: ## run benchmarks
go test -v ./... -tags bench -bench=. -benchmem -benchtime=1000x
.PHONY: bench-compare
bench-compare: ## run benchmarks compare for last two commits
cob -bench-cmd make -bench-args bench -threshold 0.7
.PHONY: bench-integration
bench-integration: ## run integration benchmarks
go test -v ./... -tags bench_integration -bench=. -benchmem -benchtime=1x
.PHONY: bench-compare-integration
bench-compare-integration: ## run integration benchmarks
cob -bench-cmd make -bench-args bench-integration -threshold 0.7
##@ Test utils
.PHONY: publish_tests
publish_tests: ## send results to testrail
${GOPATH}/bin/testrail-cli --URL=https://insolar.testrail.io/ --USER=$(TR_USER) --PASSWORD=$(TR_PASSWORD) --RUN_ID=108 --FILE=$(TEST_LOG_FILENAME)
.PHONY: docker_postgresql
docker_postgresql: ## start docker with postgresql
./postgresql-docker/doker_run.sh