Add unit-test target to make file, run all test excluding subsystem
Add go generate to Makefile
@@ -9,7 +9,7 @@ lint:
golangci-lint run -v
.PHONY: build
-build: lint
+build: lint unit-test
mkdir -p build
CGO_ENABLED=0 go build -o build/bm-inventory cmd/main.go
@@ -19,6 +19,9 @@ clean:
format:
goimports -w -l cmd/ internal/
+generate:
+ go generate $(shell go list ./... | grep -v 'restapi\|client')
+
generate-from-swagger:
rm -rf client models restapi
docker run -u $(UID):$(UID) -v $(PWD):$(PWD) -v /etc/passwd:/etc/passwd -w $(PWD) quay.io/goswagger/swagger generate server --template=stratoscale -f swagger.yaml --template-dir=/templates/contrib
@@ -99,6 +102,9 @@ test:
DB_PORT=$(shell minikube service mariadb --url| sed 's/http:\/\///g' | cut -d ":" -f 2) \
go test -v ./subsystem/... -count=1 -ginkgo.focus=${FOCUS} -ginkgo.v $(SYSTEM_TEST)
+unit-test:
+ go test -v $(shell go list ./... | grep -v subsystem) -cover
+
.PHONY: subsystem
subsystem: deploy-all subsystem-run
