From 72a4f829ae08fa089075eabe12a663aae2e87278 Mon Sep 17 00:00:00 2001 From: Jan Jasek Date: Mon, 27 Apr 2026 12:37:28 +0200 Subject: [PATCH] Add parameter for HorizonTest and set in test-operator job This PR adds additional parameter to horizontest CR in order to modify projecttext xpath based on upstream and downstream dashboard theme and set the new parameter in test-operator job. --- api/bases/test.openstack.org_horizontests.yaml | 6 ++++++ api/v1beta1/horizontest_types.go | 7 +++++++ config/crd/bases/test.openstack.org_horizontests.yaml | 6 ++++++ config/samples/test_v1beta1_horizontest.yaml | 3 +++ internal/controller/horizontest_controller.go | 1 + zuul.d/jobs.yaml | 1 + 6 files changed, 24 insertions(+) diff --git a/api/bases/test.openstack.org_horizontests.yaml b/api/bases/test.openstack.org_horizontests.yaml index 2af355f5..2cc24c40 100644 --- a/api/bases/test.openstack.org_horizontests.yaml +++ b/api/bases/test.openstack.org_horizontests.yaml @@ -1325,6 +1325,12 @@ spec: ProjectNameXpath is the xpath to select project name on the horizon dashboard based on the u/s or d/s theme type: string + projectTextXpath: + description: |- + ProjectTextXpath is the xpath to element displaying + current project name on the horizon dashboard based + on the u/s or d/s theme + type: string repoUrl: default: https://review.opendev.org/openstack/horizon description: RepoUrl is the URL of the Horizon repository. diff --git a/api/v1beta1/horizontest_types.go b/api/v1beta1/horizontest_types.go index e8f2c3f4..eca3590b 100644 --- a/api/v1beta1/horizontest_types.go +++ b/api/v1beta1/horizontest_types.go @@ -52,6 +52,13 @@ type HorizonTestSpec struct { // on the horizon dashboard based on the u/s or d/s theme ProjectNameXpath string `json:"projectNameXpath"` + // +kubebuilder:validation:Optional + // +operator-sdk:csv:customresourcedefinitions:type=spec + // ProjectTextXpath is the xpath to element displaying + // current project name on the horizon dashboard based + // on the u/s or d/s theme + ProjectTextXpath string `json:"projectTextXpath"` + // +kubebuilder:validation:Required // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=253 diff --git a/config/crd/bases/test.openstack.org_horizontests.yaml b/config/crd/bases/test.openstack.org_horizontests.yaml index 2af355f5..2cc24c40 100644 --- a/config/crd/bases/test.openstack.org_horizontests.yaml +++ b/config/crd/bases/test.openstack.org_horizontests.yaml @@ -1325,6 +1325,12 @@ spec: ProjectNameXpath is the xpath to select project name on the horizon dashboard based on the u/s or d/s theme type: string + projectTextXpath: + description: |- + ProjectTextXpath is the xpath to element displaying + current project name on the horizon dashboard based + on the u/s or d/s theme + type: string repoUrl: default: https://review.opendev.org/openstack/horizon description: RepoUrl is the URL of the Horizon repository. diff --git a/config/samples/test_v1beta1_horizontest.yaml b/config/samples/test_v1beta1_horizontest.yaml index f6554de6..4ca0d7b6 100644 --- a/config/samples/test_v1beta1_horizontest.yaml +++ b/config/samples/test_v1beta1_horizontest.yaml @@ -62,6 +62,9 @@ spec: # ProjectNameXpath is the xpath to select project name on dashboard (optional) projectNameXpath: "//span[@class='rcueicon rcueicon-folder-open']/ancestor::li" + # ProjectTextXpath is the xpath to element displaying current project (optional) + projectTextXpath: ".//span[@class='rcueicon rcueicon-folder-open']/ancestor::li" + # Privileged # ---------- # diff --git a/internal/controller/horizontest_controller.go b/internal/controller/horizontest_controller.go index f78729d1..8cf48df9 100644 --- a/internal/controller/horizontest_controller.go +++ b/internal/controller/horizontest_controller.go @@ -187,6 +187,7 @@ func (r *HorizonTestReconciler) PrepareHorizonTestEnvVars( "HORIZON_KEYS_FOLDER": "/etc/test_operator", "EXTRA_FLAG": instance.Spec.ExtraFlag, "PROJECT_NAME_XPATH": instance.Spec.ProjectNameXpath, + "PROJECT_TEXT_XPATH": instance.Spec.ProjectTextXpath, }) return envVars diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 0d7069e9..bfed1ff2 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -127,6 +127,7 @@ cifmw_test_operator_horizontest_dashboard_url: "https://horizon-openstack.apps-crc.testing/" cifmw_test_operator_horizontest_extra_flag: "not pagination and test_users.py" cifmw_test_operator_horizontest_project_name_xpath: //*[@class="context-project"]//ancestor::ul + cifmw_test_operator_horizontest_project_text_xpath: './/*[@class="context-project"]' cifmw_test_operator_horizontest_extra_mounts: - name: v1 region: r1