代码拉取完成,页面将自动刷新
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
else
GOBIN=$(shell go env GOBIN)
endif
INIT_OPTS=init \
--workload-config .workloadConfig/workload.yaml \
--repo github.com/acme/acme-cnp-mgr \
--skip-go-version-check
CREATE_OPTS=create api \
--workload-config .workloadConfig/workload.yaml \
--controller \
--resource
define create_path
if [ ! -d $(1)/.workloadConfig ]; then\
mkdir -p $(1)/.workloadConfig;\
fi
endef
export BASE_DIR := $(shell pwd)
export OPERATOR_BUILDER_PATH := $(BASE_DIR)/bin
.PHONY: build install test debug
build:
go build -o bin/operator-builder cmd/operator-builder/main.go
install: build
sudo cp bin/operator-builder /usr/local/bin/operator-builder
#
# traditional testing
#
GOLANGCI_LINT_VERSION ?= v1.45.2
install-linter:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
sh -s -- -b $$(go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
lint:
golangci-lint run
test:
go test -cover -coverprofile=./bin/coverage.out ./...
test-coverage-view: test
go tool cover -html=./bin/coverage.out
test-commit:
test/scripts/commit-check-latest.sh
#
# debug testing with delve
#
TEST_WORKLOAD_PATH ?= test/cases/standalone
debug-clean:
rm -rf $(TEST_WORKLOAD_PATH)/*
debug-init: debug-clean
dlv debug ./cmd/operator-builder --wd $(TEST_WORKLOAD_PATH) -- $(INIT_OPTS)
debug-create:
dlv debug ./cmd/operator-builder --wd $(TEST_WORKLOAD_PATH) -- $(CREATE_OPTS)
debug: debug-init debug-create
#
# simple functional code generation testing outside of codebase itself
#
FUNC_TEST_PATH ?= /tmp/operator-builder-func-test
func-test-clean:
if [ -d $(FUNC_TEST_PATH) ]; then rm -rf $(FUNC_TEST_PATH)/*; fi
func-test-init: build func-test-clean
$(call create_path,$(FUNC_TEST_PATH))
cp -r $(BASE_DIR)/$(TEST_WORKLOAD_PATH)/.workloadConfig/* $(FUNC_TEST_PATH)/.workloadConfig ;
cd $(FUNC_TEST_PATH) && $(OPERATOR_BUILDER_PATH)/operator-builder $(INIT_OPTS)
func-test-create:
cd $(FUNC_TEST_PATH) && $(OPERATOR_BUILDER_PATH)/operator-builder $(CREATE_OPTS)
func-test: func-test-init func-test-create
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。