Skip to content

Commit 6b8ffe7

Browse files
committed
Skip Static test
In order to run upstream tests in a container with make test we need to be able to skip the static check Signed-off-by: Benjamin Pickard <[email protected]>
1 parent 5d5a98d commit 6b8ffe7

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ COMPUTE_NODES ?= 2
99

1010
OCI_BIN ?= docker
1111

12+
SKIP_STATIC_CHECK ?= false
13+
1214
build:
1315
hack/build-go.sh
1416

@@ -23,7 +25,10 @@ install-tools:
2325
hack/install-kubebuilder-tools.sh
2426

2527
test: build install-tools
26-
hack/test-go.sh
28+
hack/test-go.sh --skip-static-check false
29+
30+
test-skip-static: build
31+
hack/test-go.sh --skip-static-check true
2732

2833
kind:
2934
hack/e2e-setup-kind-cluster.sh -n $(COMPUTE_NODES)

hack/test-go.sh

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,37 @@
11
#!/usr/bin/env bash
22
# single test: go test -v ./pkg/storage/
33
# without cache: go test -count=1 -v ./pkg/storage/
4-
set -e -x
4+
set -eox pipefail
55

66
GO=${GO:-go}
77

8+
9+
while true; do
10+
case "$1" in
11+
-s|--skip-static-check)
12+
SKIP_STATIC_CHECK=false
13+
break
14+
;;
15+
*)
16+
echo "define argument -s (skip static check)"
17+
exit 1
18+
esac
19+
done
20+
821
echo "Running go vet ..."
922
${GO} vet --tags=test ./cmd/... ./pkg/...
1023

1124
BASEDIR=$(pwd)
1225

13-
echo "Installing golang staticcheck ..."
14-
GOBIN=${BASEDIR}/bin go install honnef.co/go/tools/cmd/staticcheck@latest
15-
16-
echo "Running golang staticcheck ..."
17-
${BASEDIR}/bin/staticcheck --tags=test ./...
26+
if [ $SKIP_STATIC_CHECK ]
27+
then
28+
echo "Skipped golang staticcheck"
29+
else
30+
echo "Installing golang staticcheck ..."
31+
GOBIN=${BASEDIR}/bin go install honnef.co/go/tools/cmd/staticcheck@latest
32+
echo "Running golang staticcheck ..."
33+
${BASEDIR}/bin/staticcheck --tags=test ./...
34+
fi
1835

1936
echo "Running go tests..."
2037
KUBEBUILDER_ASSETS="$(pwd)/bin" ${GO} test \

0 commit comments

Comments
 (0)