From 7a7bbbf9cb5f3657ee243e514c90cb754545c910 Mon Sep 17 00:00:00 2001 From: Predrag Knezevic Date: Fri, 9 Jan 2026 17:31:43 +0100 Subject: [PATCH] Discover service namespace in e2e metrics tests Previously, the metrics test assumed the service was in a hardcoded namespace. This change queries for the service across all namespaces to find its actual location, making the test more robust against various deployment configurations. --- test/e2e/steps/steps.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/e2e/steps/steps.go b/test/e2e/steps/steps.go index 7beb177526..e1a55934dd 100644 --- a/test/e2e/steps/steps.go +++ b/test/e2e/steps/steps.go @@ -537,7 +537,11 @@ func randomAvailablePort() (int, error) { func SendMetricsRequest(ctx context.Context, serviceAccount string, endpoint string, controllerName string) error { sc := scenarioCtx(ctx) - v, err := k8sClient("get", "service", "-n", olmNamespace, fmt.Sprintf("%s-service", controllerName), "-o", "json") + serviceNs, err := k8sClient("get", "service", "-A", "-o", fmt.Sprintf(`jsonpath={.items[?(@.metadata.name=="%s-service")].metadata.namespace}`, controllerName)) + if err != nil { + return err + } + v, err := k8sClient("get", "service", "-n", serviceNs, fmt.Sprintf("%s-service", controllerName), "-o", "json") if err != nil { return err }