Skip to content

Commit 680bff8

Browse files
committed
Enable Prow tests
The project infra has been configured for this repository. Just need to make sure the appropriate scripts are in place. Signed-off-by: Alexander Wels <awels@redhat.com>
1 parent 7fc0344 commit 680bff8

File tree

13 files changed

+693
-698
lines changed

13 files changed

+693
-698
lines changed

.github/workflows/lint.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

Makefile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,8 @@ $(info Using kubevirtci kubectl)
6868
KUBECTL_PATH = $(PWD)/cluster-up/kubectl.sh
6969
endif
7070

71-
# CONTAINER_TOOL defines the container tool to be used for building images.
72-
# Be aware that the target commands are only tested with Docker which is
73-
# scaffolded by default. However, you might want to replace it to use other
74-
# tools. (i.e. podman)
75-
CONTAINER_TOOL ?= docker
71+
MIGRATION_CONTROLLER_NAMESPACE ?= kubevirt
72+
CONTAINER_TOOL ?= podman
7673

7774
# Setting SHELL to bash allows bash commands to be executed by recipes.
7875
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
@@ -135,16 +132,18 @@ vet: ## Run go vet against code.
135132
go vet ./...
136133

137134
.PHONY: test
138-
test: manifests generate fmt vet setup-envtest ## Run tests.
139-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
135+
test: manifests generate fmt vet setup-envtest gotestsum ## Run tests.
136+
@echo "Running unit tests gotestsum $(GOTESTSUM)"
137+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" $(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.functest.xml -- $$(go list ./... | grep -v /e2e) -coverprofile cover.out
140138

141139
# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
142140
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
143141
# CertManager is installed by default; skip with:
144142
# - CERT_MANAGER_INSTALL_SKIP=true
145143
.PHONY: test-e2e
146-
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
147-
go test ./test/e2e/ -v -ginkgo.v --kubectl-path=$(KUBECTL_PATH) --test-kubeconfig=$(KUBECONFIG) --kubeurl=$(KUBEURL)
144+
test-e2e: manifests generate fmt vet gotestsum ## Run the e2e tests. Expected an isolated environment using Kind.
145+
@echo "Running e2e tests gotestsum $(GOTESTSUM)"
146+
$(GOTESTSUM) --junitfile $(ARTIFACTS)/junit.functest.xml -- ./test/e2e/ -v -ginkgo.v --migration-controller-namespace=$(MIGRATION_CONTROLLER_NAMESPACE) --kubectl-path=$(KUBECTL_PATH) --test-kubeconfig=$(KUBECONFIG) --kubeurl=$(KUBEURL)
148147

149148
.PHONY: lint
150149
lint: golangci-lint ## Run golangci-lint linter
@@ -243,6 +242,8 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
243242
CLIENT_GEN ?= $(LOCALBIN)/client-gen
244243
ENVTEST ?= $(LOCALBIN)/setup-envtest
245244
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
245+
ARTIFACTS ?= $(PWD)/_artifacts
246+
GOTESTSUM ?= $(LOCALBIN)/gotestsum
246247

247248
## Tool Versions
248249
KUSTOMIZE_VERSION ?= v5.6.0
@@ -254,6 +255,7 @@ ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller
254255
#ENVTEST_K8S_VERSION is the version of Kubernetes to use for setting up ENVTEST binaries (i.e. 1.31)
255256
ENVTEST_K8S_VERSION ?= $(shell go list -m -f "{{ .Version }}" k8s.io/api | awk -F'[v.]' '{printf "1.%d", $$3}')
256257
GOLANGCI_LINT_VERSION ?= v1.63.4
258+
GOTESTSUM_VERSION ?= v1.13.0
257259

258260
.PHONY: kustomize
259261
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
@@ -270,6 +272,11 @@ client-gen: $(CLIENT_GEN) ## Download client-gen locally if necessary.
270272
$(CLIENT_GEN): $(LOCALBIN)
271273
$(call go-install-tool,$(CLIENT_GEN),k8s.io/code-generator/cmd/client-gen,$(CLIENT_GEN_VERSION))
272274

275+
.PHONY: gotestsum
276+
gotestsum: $(GOTESTSUM) ## Download gotestsum locally if necessary.
277+
$(GOTESTSUM): $(LOCALBIN)
278+
$(call go-install-tool,$(GOTESTSUM),gotest.tools/gotestsum,$(GOTESTSUM_VERSION))
279+
273280
.PHONY: setup-envtest
274281
setup-envtest: envtest ## Download the binaries required for ENVTEST in the local bin directory.
275282
@echo "Setting up envtest binaries for Kubernetes version $(ENVTEST_K8S_VERSION)..."

config/default/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Adds namespace to all resources.
2-
namespace: kubevirt-migration-system
2+
namespace: kubevirt
33

44
# Value of this field is prepended to the
55
# names of all resources, e.g. a deployment named

config/manager/controller.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
apiVersion: v1
2-
kind: Namespace
3-
metadata:
4-
labels:
5-
control-plane: controller
6-
app.kubernetes.io/name: kubevirt-migration-controller
7-
app.kubernetes.io/managed-by: kustomize
8-
name: system
9-
---
1+
102
apiVersion: apps/v1
113
kind: Deployment
124
metadata:

hack/cluster-up.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ source ./cluster-up/hack/common.sh
88
source ./cluster-up/cluster/${KUBEVIRT_PROVIDER}/provider.sh
99

1010
# Point at latest KubeVirt release
11-
export KV_RELEASE=v1.5.2
11+
export KV_RELEASE=${KV_RELEASE:-v1.6.1}
12+
1213
# Deploy the KubeVirt operator
1314
_kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/${KV_RELEASE}/kubevirt-operator.yaml
1415
# Create the KubeVirt CR (instance deployment request) which triggers the actual installation

hack/test-e2e.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
#Set the KubeVirt release to 1.6.1
6+
KUBEVIRT_PROVIDER=k8s-1.32 KV_RELEASE=${KV_RELEASE:-v1.6.1} make cluster-up
7+
8+
KUBEVIRT_PROVIDER=k8s-1.32 make cluster-sync
9+
10+
kubectl=${PWD}/cluster-up/kubectl.sh
11+
12+
$kubectl get pods -n kubevirt
13+
14+
KUBEVIRT_PROVIDER=k8s-1.32 make test-e2e

0 commit comments

Comments
 (0)