diff --git a/.gitignore b/.gitignore index 43e1681..2726d2d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ testfile .neofs-cli.yml .cache + +coverage.txt +coverage.html diff --git a/Makefile b/Makefile index 77c7436..1797e7a 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ BINDIR = bin DIRS = $(BINDIR) BINS = "$(BINDIR)/neofs-http-gw" -.PHONY: help all dep clean fmts fmt imports test lint docker/lint +.PHONY: help all dep clean fmts fmt imports test cover lint docker/lint # Make all binaries all: $(BINS) @@ -43,6 +43,15 @@ dep: GO111MODULE=on \ go mod tidy -v && echo OK +# Run tests +test: + @go test ./... -cover + +# Run tests with race detection and produce coverage output +cover: + @go test -v -race ./... -coverprofile=coverage.txt -covermode=atomic + @go tool cover -html=coverage.txt -o coverage.html + # Run all code formatters fmts: fmt imports