Skip to content

Commit

Permalink
Fix conformance suite
Browse files Browse the repository at this point in the history
The conformance suite was using deprecated ginkgo v1 functionality. This commit migrates it to v2, which makes the tests run again.

Signed-off-by: Lennart Jern <[email protected]>
  • Loading branch information
lentzi90 committed Nov 29, 2024
1 parent 7e898a9 commit 0b90d53
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ out
# Vscode files
.vscode

# Zed files
.zed_server

# This is where the result of the go build goes
/output*/
/_output*/
Expand Down
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,12 @@ test-e2e-image-prerequisites:

CONFORMANCE_E2E_ARGS ?= -kubetest.config-file=$(KUBETEST_CONF_PATH)
CONFORMANCE_E2E_ARGS += $(E2E_ARGS)
CONFORMANCE_GINKGO_ARGS ?= -stream
.PHONY: test-conformance
test-conformance: $(GINKGO) e2e-prerequisites ## Run clusterctl based conformance test on workload cluster (requires Docker).
time $(GINKGO) -trace -show-node-events -v -tags=e2e -focus="conformance" $(CONFORMANCE_GINKGO_ARGS) ./test/e2e/suites/conformance/... -- -config-path="$(E2E_CONF_PATH)" -artifacts-folder="$(ARTIFACTS)" --data-folder="$(E2E_DATA_DIR)" $(CONFORMANCE_E2E_ARGS)
time $(GINKGO) -trace -show-node-events -v -tags=e2e -focus="conformance" $(CONFORMANCE_GINKGO_ARGS) \
./test/e2e/suites/conformance/... -- \
-config-path="$(E2E_CONF_PATH)" -artifacts-folder="$(ARTIFACTS)" \
--data-folder="$(E2E_DATA_DIR)" $(CONFORMANCE_E2E_ARGS)

test-conformance-fast: ## Run clusterctl based conformance test on workload cluster (requires Docker) using a subset of the conformance suite in parallel.
$(MAKE) test-conformance CONFORMANCE_E2E_ARGS="-kubetest.config-file=$(KUBETEST_FAST_CONF_PATH) -kubetest.ginkgo-nodes=5 $(E2E_ARGS)"
Expand Down Expand Up @@ -381,9 +383,9 @@ staging-manifests:
##@ Release
## --------------------------------------

ifneq (,$(findstring -,$(RELEASE_TAG)))
PRE_RELEASE=true
endif
ifneq (,$(findstring -,$(RELEASE_TAG)))
PRE_RELEASE=true
endif
PREVIOUS_TAG ?= $(shell git tag -l | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$$" | sort -V | grep -B1 $(RELEASE_TAG) | head -n 1 2>/dev/null)
## set by Prow, ref name of the base branch, e.g., main
RELEASE_DIR := out
Expand All @@ -392,11 +394,11 @@ RELEASE_NOTES_DIR := _releasenotes
.PHONY: $(RELEASE_DIR)
$(RELEASE_DIR):
mkdir -p $(RELEASE_DIR)/

.PHONY: $(RELEASE_NOTES_DIR)
$(RELEASE_NOTES_DIR):
mkdir -p $(RELEASE_NOTES_DIR)/

.PHONY: $(BUILD_DIR)
$(BUILD_DIR):
@mkdir -p $(BUILD_DIR)
Expand Down Expand Up @@ -596,7 +598,7 @@ compile-e2e: ## Test e2e compilation
.PHONY: FORCE
FORCE:

## --------------------------------------
## --------------------------------------
## Helpers
## --------------------------------------

Expand Down
1 change: 0 additions & 1 deletion test/e2e/data/e2e_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

# To run tests, run the following from the root of this repository.
# `OPENSTACK_CLOUD=capo-e2e OPENSTACK_CLOUD_YAML_FILE=/tmp/clouds.yaml make test-conformance`
# The -stream flag will make Ginkgo print results to the screen in real-time.

managementClusterName: capo-e2e

Expand Down
16 changes: 7 additions & 9 deletions test/e2e/suites/conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gmeasure"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/ptr"
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
Expand All @@ -39,7 +40,6 @@ import (
var _ = Describe("conformance tests", func() {
var (
namespace *corev1.Namespace
ctx context.Context
specName = "conformance"
)

Expand All @@ -53,7 +53,7 @@ var _ = Describe("conformance tests", func() {
shared.ApplyCoreImagesPlus(ctx, e2eCtx)
})

Measure(specName, func(b Benchmarker) {
It(specName, func(ctx context.Context) {
name := fmt.Sprintf("cluster-%s", namespace.Name)
kubernetesVersion := e2eCtx.E2EConfig.GetVariable(shared.KubernetesVersion)

Expand All @@ -70,7 +70,10 @@ var _ = Describe("conformance tests", func() {
controlPlaneMachineCount, err := strconv.ParseInt(e2eCtx.E2EConfig.GetVariable("CONFORMANCE_CONTROL_PLANE_MACHINE_COUNT"), 10, 64)
Expect(err).NotTo(HaveOccurred())

b.Time("cluster creation", func() {
experiment := gmeasure.NewExperiment(specName)
AddReportEntry(experiment.Name, experiment)

experiment.MeasureDuration("cluster creation", func() {
result := &clusterctl.ApplyClusterTemplateAndWaitResult{}
clusterctl.ApplyClusterTemplateAndWait(ctx, clusterctl.ApplyClusterTemplateAndWaitInput{
ClusterProxy: e2eCtx.Environment.BootstrapClusterProxy,
Expand All @@ -93,7 +96,7 @@ var _ = Describe("conformance tests", func() {
})

workloadProxy := e2eCtx.Environment.BootstrapClusterProxy.GetWorkloadCluster(ctx, namespace.Name, name)
b.Time("conformance suite", func() {
experiment.MeasureDuration("conformance suite", func() {
err := kubetest.Run(ctx,
kubetest.RunInput{
ClusterProxy: workloadProxy,
Expand All @@ -104,10 +107,5 @@ var _ = Describe("conformance tests", func() {
)
Expect(err).To(BeNil(), "error on kubetest execution")
})
}, 1)

AfterEach(func() {
// Dumps all the resources in the spec namespace, then cleanups the cluster object and the spec namespace itself.
shared.DumpSpecResourcesAndCleanup(ctx, specName, namespace, e2eCtx)
})
})

0 comments on commit 0b90d53

Please sign in to comment.