Remove coverage tests

This commit is contained in:
Ian Howell 2019-06-06 08:59:59 -05:00
parent ed6cd68e55
commit 50f29ca75d
2 changed files with 1 additions and 36 deletions

View File

@ -15,12 +15,6 @@ ADDTL_LINTERS := goconst,gofmt,unparam
PKG := ./... PKG := ./...
TESTS := . TESTS := .
# coverage
COVER := $(SCRIPTS_DIR)/coverage_test.sh
COVER_FILE := cover.out
MIN_COVERAGE := 70
.PHONY: build .PHONY: build
build: build:
@CGO_ENABLED=0 go build -o $(BINDIR)/$(EXECUTABLE_CLI) $(GO_FLAGS) @CGO_ENABLED=0 go build -o $(BINDIR)/$(EXECUTABLE_CLI) $(GO_FLAGS)
@ -30,19 +24,13 @@ test: build
test: lint test: lint
test: TESTFLAGS += -race -v test: TESTFLAGS += -race -v
test: unit-tests test: unit-tests
test: cover
.PHONY: unit-tests .PHONY: unit-tests
unit-tests: build unit-tests: build
@echo "Performing unit test step..." @echo "Performing unit test step..."
@go test -run $(TESTS) $(PKG) $(TESTFLAGS) -coverprofile=$(COVER_FILE) -coverpkg=$(PKG) @go test -run $(TESTS) $(PKG) $(TESTFLAGS)
@echo "All unit tests passed" @echo "All unit tests passed"
.PHONY: cover
cover: unit-tests
@./$(COVER) $(COVER_FILE) $(MIN_COVERAGE)
.PHONY: lint .PHONY: lint
lint: lint:
@echo "Performing linting step..." @echo "Performing linting step..."
@ -52,7 +40,6 @@ lint:
.PHONY: clean .PHONY: clean
clean: clean:
@rm -fr $(BINDIR) @rm -fr $(BINDIR)
@rm -fr $(COVER_FILE)
.PHONY: docs .PHONY: docs
docs: docs:

View File

@ -1,22 +0,0 @@
#!/bin/bash
check_coverage() {
cover_file=$1
min_coverage=$2
sed -i -e "\,airshipctl/pkg/apis\|airshipctl/pkg/client,d" "${cover_file}"
coverage_float=$(go tool cover -func="${cover_file}" | awk "/^total:/ { print \$3 }")
coverage_int=${coverage_float%.*}
if (( "${coverage_int}" < "${min_coverage}" )) ; then
echo "Coverage is at ${coverage_float}, but the required coverage is ${min_coverage}"
exit 1
else
echo "Overall coverage: ${coverage_float} of statements"
fi
}
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <cover_file> <required_coverage>"
exit 1
fi
check_coverage "$1" "$2"