-
Notifications
You must be signed in to change notification settings - Fork 73
🌱 Migrate operator upgrade e2e tests to Godog/Cucumber BDD framework #2538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -240,6 +240,17 @@ verify-crd-compatibility: $(CRD_DIFF) manifests | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| #SECTION Test | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| define install-sh | ||||||||||||||||||||||
| .PHONY: $(1)/install.sh | ||||||||||||||||||||||
| $(1)/install.sh: manifests | ||||||||||||||||||||||
| @echo -e "\n\U1F4D8 Using $(1).yaml as source manifest\n" | ||||||||||||||||||||||
| sed "s/cert-git-version/cert-$$(VERSION)/g" manifests/$(1).yaml > $(2) | ||||||||||||||||||||||
| MANIFEST=$(2) INSTALL_DEFAULT_CATALOGS=false DEFAULT_CATALOG=$$(RELEASE_CATALOGS) envsubst '$$$$DEFAULT_CATALOG,$$$$CERT_MGR_VERSION,$$$$INSTALL_DEFAULT_CATALOGS,$$$$MANIFEST' < scripts/install.tpl.sh > $(1)-install.sh | ||||||||||||||||||||||
|
Comment on lines
+244
to
+248
|
||||||||||||||||||||||
| .PHONY: $(1)/install.sh | |
| $(1)/install.sh: manifests | |
| @echo -e "\n\U1F4D8 Using $(1).yaml as source manifest\n" | |
| sed "s/cert-git-version/cert-$$(VERSION)/g" manifests/$(1).yaml > $(2) | |
| MANIFEST=$(2) INSTALL_DEFAULT_CATALOGS=false DEFAULT_CATALOG=$$(RELEASE_CATALOGS) envsubst '$$$$DEFAULT_CATALOG,$$$$CERT_MGR_VERSION,$$$$INSTALL_DEFAULT_CATALOGS,$$$$MANIFEST' < scripts/install.tpl.sh > $(1)-install.sh | |
| .PHONY: $(1)-install.sh | |
| $(1)-install.sh: manifests | |
| @echo -e "\n\U1F4D8 Using $(1).yaml as source manifest\n" | |
| sed "s/cert-git-version/cert-$$(VERSION)/g" manifests/$(1).yaml > $(2) | |
| MANIFEST=$(2) INSTALL_DEFAULT_CATALOGS=false DEFAULT_CATALOG=$$(RELEASE_CATALOGS) envsubst '$$$$DEFAULT_CATALOG,$$$$CERT_MGR_VERSION,$$$$INSTALL_DEFAULT_CATALOGS,$$$$MANIFEST' < scripts/install.tpl.sh > $@ |
Copilot
AI
Mar 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test-st2ex-e2e still exports MANIFEST, TEST_CLUSTER_CATALOG_NAME, and TEST_CLUSTER_EXTENSION_NAME, but the upgrade test flow no longer consumes these variables (the old pre/post upgrade scripts were removed and the new Godog feature hard-codes the resource names). These exports are now dead configuration and can be removed to avoid confusion about what the upgrade tests actually use.
| test-st2ex-e2e: export MANIFEST := $(STANDARD_RELEASE_MANIFEST) | |
| test-st2ex-e2e: export TEST_CLUSTER_CATALOG_NAME := test-catalog | |
| test-st2ex-e2e: export TEST_CLUSTER_EXTENSION_NAME := test-package |
Copilot
AI
Mar 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in help text: swichover should be switchover.
| test-st2ex-e2e: experimental/install.sh standard/install.sh $(TEST_UPGRADE_E2E_TASKS) #HELP Run swichover (standard -> experimental) e2e tests on a local kind cluster | |
| test-st2ex-e2e: experimental/install.sh standard/install.sh $(TEST_UPGRADE_E2E_TASKS) #HELP Run switchover (standard -> experimental) e2e tests on a local kind cluster |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,9 +31,12 @@ type scenarioContext struct { | |
| namespace string | ||
| clusterExtensionName string | ||
| clusterExtensionRevisionName string | ||
| clusterCatalogName string | ||
| addedResources []resource | ||
| removedResources []unstructured.Unstructured | ||
| backGroundCmds []*exec.Cmd | ||
| metricsResponse map[string]string | ||
| leaderPods map[string]string // component name -> leader pod name | ||
|
|
||
| extensionObjects []client.Object | ||
| } | ||
|
|
@@ -89,30 +92,37 @@ func RegisterHooks(sc *godog.ScenarioContext) { | |
| sc.After(ScenarioCleanup) | ||
| } | ||
|
|
||
| func BeforeSuite() { | ||
| if devMode { | ||
| logger = textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))) | ||
| } else { | ||
| logger = textlogger.NewLogger(textlogger.NewConfig()) | ||
| } | ||
|
|
||
| func detectOLMDeployment() (*appsv1.Deployment, error) { | ||
| raw, err := k8sClient("get", "deployments", "-A", "-l", "app.kubernetes.io/part-of=olm", "-o", "jsonpath={.items}") | ||
| if err != nil { | ||
| panic(fmt.Errorf("failed to get OLM deployments: %v", err)) | ||
| return nil, err | ||
| } | ||
| dl := []appsv1.Deployment{} | ||
| if err := json.Unmarshal([]byte(raw), &dl); err != nil { | ||
| panic(fmt.Errorf("failed to unmarshal OLM deployments: %v", err)) | ||
| return nil, fmt.Errorf("failed to unmarshal OLM deployments: %v", err) | ||
| } | ||
| var olm *appsv1.Deployment | ||
|
|
||
| for _, d := range dl { | ||
| if d.Name == olmDeploymentName { | ||
| olm = &d | ||
| olmNamespace = d.Namespace | ||
| break | ||
| return &d, nil | ||
| } | ||
|
Comment on lines
105
to
108
|
||
| } | ||
| return nil, fmt.Errorf("failed to detect OLM Deployment") | ||
| } | ||
|
|
||
| func BeforeSuite() { | ||
| if devMode { | ||
| logger = textlogger.NewLogger(textlogger.NewConfig(textlogger.Verbosity(1))) | ||
| } else { | ||
| logger = textlogger.NewLogger(textlogger.NewConfig()) | ||
| } | ||
|
|
||
| olm, err := detectOLMDeployment() | ||
| if err != nil { | ||
| logger.Info("OLM deployments not found; skipping feature gate detection (upgrade scenarios will install OLM in Background)") | ||
| return | ||
| } | ||
| olmNamespace = olm.Namespace | ||
|
|
||
| featureGatePattern := regexp.MustCompile(`--feature-gates=([[:alnum:]]+)=(true|false)`) | ||
| for _, c := range olm.Spec.Template.Spec.Containers { | ||
|
|
@@ -147,6 +157,7 @@ func CreateScenarioContext(ctx context.Context, sc *godog.Scenario) (context.Con | |
| namespace: fmt.Sprintf("ns-%s", sc.Id), | ||
| clusterExtensionName: fmt.Sprintf("ce-%s", sc.Id), | ||
| clusterExtensionRevisionName: fmt.Sprintf("cer-%s", sc.Id), | ||
| leaderPods: make(map[string]string), | ||
| } | ||
| return context.WithValue(ctx, scenarioContextKey, scCtx), nil | ||
| } | ||
|
|
@@ -174,7 +185,7 @@ func ScenarioCleanup(ctx context.Context, _ *godog.Scenario, err error) (context | |
| return ctx, err | ||
| } | ||
|
|
||
| forDeletion := []resource{} | ||
| forDeletion := sc.addedResources | ||
| if sc.clusterExtensionName != "" { | ||
| forDeletion = append(forDeletion, resource{name: sc.clusterExtensionName, kind: "clusterextension"}) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This recipe uses
echo -ewith\U...escapes.echo -eand Unicode escape handling vary across/bin/shimplementations, so this can break in some environments. Preferprintffor portable escape/newline handling.