Skip to content

Commit

Permalink
test: Microvm controller tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Callisto13 committed Nov 25, 2022
1 parent e387193 commit 311b78c
Show file tree
Hide file tree
Showing 9 changed files with 1,117 additions and 99 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
generate: controller-gen counterfeiter ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
go generate ./...

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand All @@ -55,8 +56,8 @@ vet: ## Run go vet against code.
go vet ./...

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
test: ## Run tests.
go test -v ./controllers/... ./internal/...

##@ Build

Expand Down Expand Up @@ -130,6 +131,7 @@ $(LOCALBIN):
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
COUNTERFEITER := $(LOCALBIN)/counterfeiter

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
Expand All @@ -146,6 +148,11 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

.PHONY: counterfeiter
counterfeiter: $(COUNTERFEITER)
$(COUNTERFEITER): $(LOCALBIN)
test -s $(LOCALBIN)/counterfeiter || GOBIN=$(LOCALBIN) go install github.com/maxbrunsfeld/counterfeiter/v6

.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
$(ENVTEST): $(LOCALBIN)
Expand Down
Loading

0 comments on commit 311b78c

Please sign in to comment.