Skip to content

Commit 1f826c7

Browse files
committed
Update e2e test suite to Ginkgo v2
Signed-off-by: Hans Rakers <h.rakers@global.leaseweb.com>
1 parent ec0d351 commit 1f826c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+109
-114
lines changed

Makefile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ GH_REPO ?= kubernetes-sigs/cluster-api-provider-cloudstack
2727

2828
# Binaries
2929
CONTROLLER_GEN := $(TOOLS_BIN_DIR)/controller-gen
30-
GINKGO_V1 := $(TOOLS_BIN_DIR)/ginkgo_v1
31-
GINKGO_V2 := $(TOOLS_BIN_DIR)/ginkgo_v2
30+
GINKGO := $(TOOLS_BIN_DIR)/ginkgo
3231
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
3332
KUSTOMIZE := $(TOOLS_BIN_DIR)/kustomize
3433
MOCKGEN := $(TOOLS_BIN_DIR)/mockgen
@@ -70,10 +69,6 @@ endif
7069
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
7170
# SHELL = /usr/bin/env bash -o pipefail
7271
.SHELLFLAGS = -ec
73-
# Quiet Ginkgo for now.
74-
# The warnings are in regards to a future release.
75-
export ACK_GINKGO_DEPRECATIONS := 1.16.5
76-
export ACK_GINKGO_RC=true
7772

7873
export PATH := $(TOOLS_BIN_DIR):$(PATH)
7974

@@ -85,7 +80,7 @@ all: build
8580
## --------------------------------------
8681

8782
.PHONY: binaries
88-
binaries: $(CONTROLLER_GEN) $(GOLANGCI_LINT) $(STATIC_CHECK) $(GINKGO_V1) $(GINKGO_V2) $(MOCKGEN) $(KUSTOMIZE) managers # Builds and installs all binaries
83+
binaries: $(CONTROLLER_GEN) $(GOLANGCI_LINT) $(STATIC_CHECK) $(GINKGO) $(MOCKGEN) $(KUSTOMIZE) managers # Builds and installs all binaries
8984

9085
.PHONY: managers
9186
managers:
@@ -95,7 +90,7 @@ managers:
9590
manager-cloudstack-infrastructure: ## Build manager binary.
9691
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR)/manager .
9792

98-
export K8S_VERSION=1.25.0
93+
export K8S_VERSION=1.26.1
9994
$(KUBECTL) $(API_SERVER) $(ETCD) &:
10095
cd $(TOOLS_DIR) && curl --silent -L "https://go.kubebuilder.io/test-tools/${K8S_VERSION}/$(shell go env GOOS)/$(shell go env GOARCH)" --output - | \
10196
tar -C ./ --strip-components=1 -zvxf -
@@ -159,7 +154,7 @@ $(shell grep -qs "$(IMG)" config/default/manager_image_patch_edited.yaml || rm -
159154
generate-manifests: config/.flag.mk ## Generates crd, webhook, rbac, and other configuration manifests from kubebuilder instructions in go comments.
160155
config/.flag.mk: $(CONTROLLER_GEN) $(MANIFEST_GEN_INPUTS)
161156
sed -e 's@image: .*@image: '"$(IMG)"'@' config/default/manager_image_patch.yaml > config/default/manager_image_patch_edited.yaml
162-
$(CONTROLLER_GEN) crd:crdVersions=v1 rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
157+
$(CONTROLLER_GEN) crd:crdVersions=v1 rbac:roleName=manager-role webhook paths="{./api/...,./controllers/...}" output:crd:artifacts:config=config/crd/bases
163158
@touch config/.flag.mk
164159

165160
CONVERSION_GEN_TARGET=$(shell find api -type d -name "v*1" -exec echo {}\/zz_generated.conversion.go \;)
@@ -272,10 +267,10 @@ config/.flag-test.mk: $(CONTROLLER_GEN) $(MANIFEST_GEN_INPUTS_TEST)
272267

273268
.PHONY: test
274269
test: ## Run tests.
275-
test: generate-deepcopy-test generate-manifest-test generate-mocks lint $(GINKGO_V2) $(KUBECTL) $(API_SERVER) $(ETCD)
270+
test: generate-deepcopy-test generate-manifest-test generate-mocks lint $(GINKGO) $(KUBECTL) $(API_SERVER) $(ETCD)
276271
@./hack/testing_ginkgo_recover_statements.sh --add # Add ginkgo.GinkgoRecover() statements to controllers.
277272
@# The following is a slightly funky way to make sure the ginkgo statements are removed regardless the test results.
278-
@$(GINKGO_V2) --label-filter="!integ" --cover -coverprofile cover.out --covermode=atomic -v ./api/... ./controllers/... ./pkg/...; EXIT_STATUS=$$?;\
273+
@$(GINKGO) --label-filter="!integ" --cover -coverprofile cover.out --covermode=atomic -v ./api/... ./controllers/... ./pkg/...; EXIT_STATUS=$$?;\
279274
./hack/testing_ginkgo_recover_statements.sh --remove; exit $$EXIT_STATUS
280275

281276
CLUSTER_TEMPLATES_INPUT_FILES=$(shell find test/e2e/data/infrastructure-cloudstack/v1beta*/cluster-template* test/e2e/data/infrastructure-cloudstack/*/bases/* -type f)
@@ -285,15 +280,15 @@ e2e-cluster-templates: $(CLUSTER_TEMPLATES_OUTPUT_FILES) ## Generate cluster tem
285280
cluster-template%yaml: $(KUSTOMIZE) $(CLUSTER_TEMPLATES_INPUT_FILES)
286281
$(KUSTOMIZE) build --load-restrictor LoadRestrictionsNone $(basename $@) > $@
287282

288-
e2e-essentials: $(GINKGO_V1) $(KUBECTL) e2e-cluster-templates create-kind-cluster ## Fulfill essential tasks for e2e testing.
283+
e2e-essentials: $(GINKGO) $(KUBECTL) e2e-cluster-templates create-kind-cluster ## Fulfill essential tasks for e2e testing.
289284
IMG=$(IMG_LOCAL) make generate-manifests docker-build docker-push
290285

291286
JOB ?= .*
292287
E2E_CONFIG ?= ${REPO_ROOT}/test/e2e/config/cloudstack.yaml
293288
run-e2e: e2e-essentials ## Run e2e testing. JOB is an optional REGEXP to select certainn test cases to run. e.g. JOB=PR-Blocking, JOB=Conformance
294289
$(KUBECTL) apply -f cloud-config.yaml && \
295290
cd test/e2e && \
296-
$(GINKGO_V1) -v -trace -tags=e2e -focus=$(JOB) -skip=Conformance -skipPackage=kubeconfig_helper -nodes=1 -noColor=false ./... -- \
291+
$(GINKGO) -v --trace --tags=e2e --focus=$(JOB) --skip=Conformance --skip-package=kubeconfig_helper --nodes=1 --no-color=false ./... -- \
297292
-e2e.artifacts-folder=${REPO_ROOT}/_artifacts \
298293
-e2e.config=${E2E_CONFIG} \
299294
-e2e.skip-resource-cleanup=false -e2e.use-existing-cluster=true

hack/tools/Makefile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,8 @@ STATIC_CHECK := $(BIN_DIR)/staticcheck
8383
$(STATIC_CHECK): $(BIN_DIR) go.mod go.sum # Build staticcheck from tools folder.
8484
go build -tags=tools -o $@ honnef.co/go/tools/cmd/staticcheck
8585

86-
GINKGO_V1 := $(BIN_DIR)/ginkgo_v1
87-
$(GINKGO_V1): $(BIN_DIR) go.mod go.sum # Build staticcheck from tools folder.
88-
go build -tags=tools -o $@ github.com/onsi/ginkgo/ginkgo
89-
90-
GINKGO_V2 := $(BIN_DIR)/ginkgo_v2
91-
$(GINKGO_V2): $(BIN_DIR) go.mod go.sum # Build staticcheck from tools folder.
86+
GINKGO := $(BIN_DIR)/ginkgo
87+
$(GINKGO): $(BIN_DIR) go.mod go.sum # Build staticcheck from tools folder.
9288
go build -tags=tools -o $@ github.com/onsi/ginkgo/v2/ginkgo
9389

9490
ENVSUBST := $(BIN_DIR)/envsubst
@@ -109,10 +105,6 @@ GH: $(GTAR) $(GH_SHARE)/gh.tar.gz
109105
chmod +x $@
110106
touch -m $@
111107

112-
GINKGO := $(BIN_DIR)/ginkgo
113-
$(GINKGO): $(BIN_DIR) go.mod go.sum
114-
go build -tags=tools -o $@ github.com/onsi/ginkgo/ginkgo
115-
116108
KIND := $(BIN_DIR)/kind
117109
$(KIND): $(BIN_DIR) go.mod go.sum
118110
go build -tags tools -o $@ sigs.k8s.io/kind

hack/tools/tools.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ package tools
2121
import (
2222
_ "github.com/a8m/envsubst"
2323
_ "github.com/golang/mock/mockgen"
24-
_ "github.com/onsi/ginkgo"
2524
_ "github.com/onsi/ginkgo/ginkgo"
2625
_ "github.com/onsi/ginkgo/v2/ginkgo"
2726
_ "honnef.co/go/tools/cmd/staticcheck"

test/e2e/affinity_group.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"os"
2323
"path/filepath"
2424

25-
. "github.com/onsi/ginkgo"
25+
. "github.com/onsi/ginkgo/v2"
2626
. "github.com/onsi/gomega"
2727
corev1 "k8s.io/api/core/v1"
2828
"k8s.io/utils/pointer"

test/e2e/affinity_group_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ package e2e
2121

2222
import (
2323
"context"
24-
. "github.com/onsi/ginkgo"
24+
25+
. "github.com/onsi/ginkgo/v2"
2526
)
2627

2728
var _ = Describe("When testing affinity group", func() {

test/e2e/common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ import (
2222
"errors"
2323
"fmt"
2424
"path/filepath"
25+
"strconv"
2526
"strings"
2627
"time"
27-
"strconv"
2828

2929
apierrors "k8s.io/apimachinery/pkg/api/errors"
3030
"k8s.io/klog/v2"
3131

3232
"github.com/apache/cloudstack-go/v2/cloudstack"
3333
"github.com/blang/semver"
34-
. "github.com/onsi/ginkgo"
34+
. "github.com/onsi/ginkgo/v2"
3535
corev1 "k8s.io/api/core/v1"
3636

3737
. "github.com/onsi/gomega"

test/e2e/config/cloudstack.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ images:
1515
## PLEASE KEEP THESE UP TO DATE WITH THE COMPONENTS
1616

1717
# Cluster API v1beta1 Preloads
18-
- name: gcr.io/k8s-staging-cluster-api/cluster-api-controller:v1.2.12
18+
- name: gcr.io/k8s-staging-cluster-api/cluster-api-controller:v1.4.7
1919
loadBehavior: tryLoad
20-
- name: gcr.io/k8s-staging-cluster-api/kubeadm-bootstrap-controller:v1.2.12
20+
- name: gcr.io/k8s-staging-cluster-api/kubeadm-bootstrap-controller:v1.4.7
2121
loadBehavior: tryLoad
22-
- name: gcr.io/k8s-staging-cluster-api/kubeadm-control-plane-controller:v1.2.12
22+
- name: gcr.io/k8s-staging-cluster-api/kubeadm-control-plane-controller:v1.4.7
2323
loadBehavior: tryLoad
24-
- name: gcr.io/k8s-staging-cluster-api/capd-manager-amd64:v1.0.0
24+
- name: gcr.io/k8s-staging-cluster-api/capd-manager-amd64:v1.4.7
2525
loadBehavior: tryLoad
26-
- name: quay.io/jetstack/cert-manager-cainjector:v1.5.3
26+
- name: quay.io/jetstack/cert-manager-cainjector:v1.12.3
2727
loadBehavior: tryLoad
28-
- name: quay.io/jetstack/cert-manager-webhook:v1.5.3
28+
- name: quay.io/jetstack/cert-manager-webhook:v1.12.3
2929
loadBehavior: tryLoad
30-
- name: quay.io/jetstack/cert-manager-controller:v1.5.3
30+
- name: quay.io/jetstack/cert-manager-controller:v1.12.3
3131
loadBehavior: tryLoad
3232

3333
providers:
3434
- name: cluster-api
3535
type: CoreProvider
3636
versions:
37-
- name: v1.2.12
38-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.2.12/core-components.yaml"
37+
- name: v1.4.7
38+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.7/core-components.yaml"
3939
type: "url"
4040
contract: v1beta1
4141
replacements:
@@ -47,8 +47,8 @@ providers:
4747
- name: kubeadm
4848
type: BootstrapProvider
4949
versions:
50-
- name: v1.2.12
51-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.2.12/bootstrap-components.yaml"
50+
- name: v1.4.7
51+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.7/bootstrap-components.yaml"
5252
type: "url"
5353
contract: v1beta1
5454
replacements:
@@ -60,8 +60,8 @@ providers:
6060
- name: kubeadm
6161
type: ControlPlaneProvider
6262
versions:
63-
- name: v1.2.12
64-
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.2.12/control-plane-components.yaml"
63+
- name: v1.4.7
64+
value: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.4.7/control-plane-components.yaml"
6565
type: "url"
6666
contract: v1beta1
6767
replacements:

test/e2e/custom_disk_offering.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"os"
2323
"path/filepath"
2424

25-
. "github.com/onsi/ginkgo"
25+
. "github.com/onsi/ginkgo/v2"
2626
. "github.com/onsi/gomega"
2727
corev1 "k8s.io/api/core/v1"
2828
"k8s.io/utils/pointer"

test/e2e/custom_disk_offering_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ package e2e
2121

2222
import (
2323
"context"
24-
. "github.com/onsi/ginkgo"
24+
25+
. "github.com/onsi/ginkgo/v2"
2526
)
2627

2728
var _ = Describe("When testing with custom disk offering", func() {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
22
kind: Metadata
33
releaseSeries:
4+
- major: 1
5+
minor: 4
6+
contract: v1beta1
7+
- major: 1
8+
minor: 3
9+
contract: v1beta1
410
- major: 1
511
minor: 2
612
contract: v1beta1
13+
- major: 1
14+
minor: 1
15+
contract: v1beta1
16+
- major: 1
17+
minor: 0
18+
contract: v1beta1
19+
- major: 0
20+
minor: 4
21+
contract: v1alpha4
22+
- major: 0
23+
minor: 3
24+
contract: v1alpha3
25+
- major: 0
26+
minor: 2
27+
contract: v1alpha2

0 commit comments

Comments
 (0)