add new entry for env setup
Signed-off-by: yuswift <yuswift2018@gmail.com>
This commit is contained in:
16
Makefile
16
Makefile
@@ -2,12 +2,6 @@
|
||||
# Use of this source code is governed by a Apache license
|
||||
# that can be found in the LICENSE file.
|
||||
|
||||
# Setting SHELL to bash allows bash commands to be executed by recipes.
|
||||
# This is a requirement for 'setup-envtest.sh' in the test target.
|
||||
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
|
||||
SHELL = /usr/bin/env bash -o pipefail
|
||||
.SHELLFLAGS = -ec
|
||||
|
||||
|
||||
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
|
||||
CRD_OPTIONS ?= "crd:trivialVersions=true"
|
||||
@@ -145,13 +139,15 @@ helm-uninstall: ; $(info $(M)...Begin to helm-uninstall.) @ ## Helm-uninstall.
|
||||
|
||||
# Run tests
|
||||
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
|
||||
test: vet ;$(info $(M)...Begin to run tests.) @ ## Run tests.
|
||||
mkdir -p ${ENVTEST_ASSETS_DIR}
|
||||
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh
|
||||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./pkg/... ./cmd/... -covermode=atomic -coverprofile=coverage.txt
|
||||
test: vet test-env ;$(info $(M)...Begin to run tests.) @ ## Run tests.
|
||||
export KUBEBUILDER_ASSETS=$(shell pwd)/testbin/bin; go test ./pkg/... ./cmd/... -covermode=atomic -coverprofile=coverage.txt
|
||||
cd staging/src/kubesphere.io/api ; GOFLAGS="" go test ./...
|
||||
cd staging/src/kubesphere.io/client-go ; GOFLAGS="" go test ./...
|
||||
|
||||
.PHONY: test-env
|
||||
test-env: ;$(info $(M)...Begin to setup test env) @ ## Download unit test libraries e.g. kube-apiserver etcd.
|
||||
@hack/setup-kubebuilder-env.sh
|
||||
|
||||
.PHONY: clean
|
||||
clean: ;$(info $(M)...Begin to clean.) @ ## Clean.
|
||||
-make -C ./pkg/version clean
|
||||
|
||||
10
hack/setup-kubebuilder-env.sh
Executable file
10
hack/setup-kubebuilder-env.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Setting SHELL to bash allows bash commands to be executed by recipes.
|
||||
# This is a requirement for 'setup-envtest.sh' in the test target.
|
||||
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
|
||||
SHELL="/usr/bin/env bash -o pipefail"
|
||||
|
||||
ENVTEST_ASSETS_DIR=$(pwd)/testbin
|
||||
mkdir -p ${ENVTEST_ASSETS_DIR}
|
||||
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh
|
||||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools ${ENVTEST_ASSETS_DIR}; setup_envtest_env ${ENVTEST_ASSETS_DIR}
|
||||
Reference in New Issue
Block a user