mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-12-01 07:26:05 +07:00
fix make unit
This commit is contained in:
2
Makefile
2
Makefile
@@ -65,7 +65,7 @@ install: build
|
||||
# ================================= Testing ====================================
|
||||
# unit tests (hermetic)
|
||||
unit:
|
||||
hack/ci/unit.sh
|
||||
hack/make-rules/unit.sh
|
||||
################################################################################
|
||||
# ================================= Cleanup ====================================
|
||||
# standard cleanup target
|
||||
|
||||
@@ -16,26 +16,27 @@
|
||||
# script to run unit tests, with coverage enabled and junit xml output
|
||||
set -o errexit -o nounset -o pipefail
|
||||
|
||||
# cd to the repo root
|
||||
# cd to the repo root and setup go
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||
cd "${REPO_ROOT}"
|
||||
source hack/build/setup-go.sh
|
||||
|
||||
# build gotestsum
|
||||
cd 'hack/tools'
|
||||
go build -o "${REPO_ROOT}"/bin/gotestsum gotest.tools/gotestsum
|
||||
go build -o "${REPO_ROOT}/bin/gotestsum" gotest.tools/gotestsum
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
# run unit tests with coverage enabled and junit output
|
||||
"${REPO_ROOT}"/bin/gotestsum --junitfile=/out/junit.xml -- \
|
||||
-coverprofile=/out/unit.cov -covermode count -coverpkg sigs.k8s.io/kind/... ./...
|
||||
"${REPO_ROOT}/bin/gotestsum" --junitfile="${REPO_ROOT}/bin/junit.xml" -- \
|
||||
-coverprofile="${REPO_ROOT}/bin/unit.cov" -covermode count -coverpkg sigs.k8s.io/kind/... ./...
|
||||
|
||||
# filter out generated files
|
||||
sed '/zz_generated/d' bin/unit.cov > bin/filtered.cov
|
||||
sed '/zz_generated/d' "${REPO_ROOT}/bin/unit.cov" > "${REPO_ROOT}/bin/filtered.cov"
|
||||
|
||||
# generate cover html
|
||||
go tool cover -html=bin/filtered.cov -o bin/filtered.html
|
||||
go tool cover -html="${REPO_ROOT}/bin/filtered.cov" -o "${REPO_ROOT}/bin/filtered.html"
|
||||
|
||||
# if we are in CI, copy to the artifact upload location
|
||||
if [[ -n "${ARTIFACTS:-}" ]]; then
|
||||
cp bin/junit.xml bin/filtered.cov bin/filtered.html "${ARTIFACTS:?}/"
|
||||
cp bin/junit.xml "${REPO_ROOT}/bin/filtered.cov" "${REPO_ROOT}/bin/filtered.html" "${ARTIFACTS:?}/"
|
||||
fi
|
||||
@@ -149,6 +149,7 @@ github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
|
||||
@@ -521,6 +522,7 @@ gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gotest.tools/gotestsum v0.4.2 h1:QOdtb6bnnPUuHKkR9+/QQa8e6qjpTTP7cDi7G9/10C4=
|
||||
gotest.tools/gotestsum v0.4.2/go.mod h1:a32lmn/7xfm0+QHj8K5NyQY1NNNNhZoAp+/OHkLs77Y=
|
||||
gotest.tools/gotestsum v0.5.1 h1:SAhD6tZtArKOpsh3mClXgo3AEZkyacZ08yTS87Ug574=
|
||||
gotest.tools/gotestsum v0.5.1/go.mod h1:hC9TQserDVTWcJuARh76Ydp3ZwuE+pIIWpt2BzDLD6M=
|
||||
gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E=
|
||||
gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk=
|
||||
|
||||
Reference in New Issue
Block a user