-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
46 lines (38 loc) · 1.53 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
## help: print this help message
help:
@echo "Usage:"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ":" | sed -e 's/^/ /'
## lint: runs golangci lint based on .golangci.yml configuration
.PHONY: lint
lint:
@if ! test -f `go env GOPATH`/bin/golangci-lint; then go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0; fi
golangci-lint run -c .golangci.yml --fix -v
## test: runs tests
.PHONY: test
test:
go test -v ./... -coverprofile=unit_coverage.out -short
## unit-coverage-html: extract unit tests coverage to html format
.PHONY: unit-coverage-html
unit-coverage-html:
make test
go tool cover -html=unit_coverage.out -o unit_coverage.html
## godoc: generate documentation
.PHONY: godoc
godoc:
@if ! test -f `go env GOPATH`/bin/godoc; then go install golang.org/x/tools/cmd/godoc; fi
godoc -http=127.0.0.1:6060
## produce: produce test message (requires jq and kafka-console-producer)
## : make produce topic=exception
.PHONY: produce
produce:
jq -rc . ./testdata/message.json | kafka-console-producer --bootstrap-server 127.0.0.1:9092 --topic ${topic}
# default value
export topic=exception
## produce-with-header: produce test message with retry header (requires jq and kcat)
## : make produce-with-header topic=exception
.PHONY: produce-with-header
produce-with-header:
jq -rc . ./testdata/message.json | kcat -b 127.0.0.1:9092 -t ${topic} -P -H x-retry-count=1
.PHONY: integration-compose
integration-compose:
docker compose -f test/integration/docker-compose.yml up --wait --build --force-recreate --remove-orphans