-
Notifications
You must be signed in to change notification settings - Fork 71
🌱 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
base: main
Are you sure you want to change the base?
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 | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -238,6 +238,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
+242
to
+246
|
||||||||||||||||||||||
| .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 > $@ |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,9 +30,11 @@ type scenarioContext struct { | |
| id string | ||
| namespace string | ||
| clusterExtensionName string | ||
| clusterCatalogName string | ||
| removedResources []unstructured.Unstructured | ||
| backGroundCmds []*exec.Cmd | ||
| metricsResponse map[string]string | ||
| leaderPods map[string]string // component name -> leader pod name | ||
|
|
||
| extensionObjects []client.Object | ||
| } | ||
|
|
@@ -87,30 +89,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
102
to
105
|
||
| } | ||
| 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 { | ||
|
|
@@ -144,6 +153,7 @@ func CreateScenarioContext(ctx context.Context, sc *godog.Scenario) (context.Con | |
| id: sc.Id, | ||
| namespace: fmt.Sprintf("ns-%s", sc.Id), | ||
| clusterExtensionName: fmt.Sprintf("ce-%s", sc.Id), | ||
| leaderPods: make(map[string]string), | ||
| } | ||
| return context.WithValue(ctx, scenarioContextKey, scCtx), nil | ||
| } | ||
|
|
||
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.