From b83fdf1b4570f69e0be38fd9cc747f838896d63b Mon Sep 17 00:00:00 2001 From: Shilpa Chugh Date: Fri, 3 Jan 2025 15:13:32 +0530 Subject: [PATCH] Add keyword to find cluster type based on infrastructure --- ods_ci/tests/Resources/Common.robot | 12 ++++++------ ods_ci/tests/Resources/OCP.resource | 20 +++++++++----------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/ods_ci/tests/Resources/Common.robot b/ods_ci/tests/Resources/Common.robot index 64e227dac..036ebab00 100644 --- a/ods_ci/tests/Resources/Common.robot +++ b/ods_ci/tests/Resources/Common.robot @@ -601,14 +601,14 @@ Skip If Operator Starting Version Is Not Supported Skip If condition="${supported}"=="${FALSE}" msg=This test is skipped because starting operator version < ${minimum_version} Skip If Cluster Type Is Self-Managed - [Documentation] Skips test if cluster type is Self-managed - ${cluster_type}= Is Cluster Type Self-Managed - Skip If condition=${cluster_type}==True msg=This test is skipped for Self-managed cluster + [Documentation] Skips test if cluster type is Self-managed + ${cluster_type}= Is Cluster Type Managed + Skip If condition=${cluster_type}==False msg=This test is skipped for Self-managed cluster Skip If Cluster Type Is Managed - [Documentation] Skips test if cluster type is Managed - ${cluster_type}= Is Cluster Type Self-Managed - Skip If condition=${cluster_type}==False msg=This test is skipped for Managed cluster + [Documentation] Skips test if cluster type is Managed + ${cluster_type}= Is Cluster Type Managed + Skip If condition=${cluster_type}==True msg=This test is skipped for Managed cluster Delete All ${resource_type} In Namespace By Name [Documentation] Force delete all ${resource_type} named '${resource_type}' in namespace '${namespace}' diff --git a/ods_ci/tests/Resources/OCP.resource b/ods_ci/tests/Resources/OCP.resource index 3fc281995..228023843 100644 --- a/ods_ci/tests/Resources/OCP.resource +++ b/ods_ci/tests/Resources/OCP.resource @@ -333,17 +333,15 @@ Wait For Namespace To Be Active Log ${value} Should Be Equal As Integers ${rc} 0 -Is Cluster Type Self-Managed - [Documentation] Get the value of cluster type depending on the console URL domain - ... Returns ${TRUE} if cluster type is Self-Managed - ... Returns ${FALSE} if cluster type is Managed - ${matches}= Get Regexp Matches ${OCP_CONSOLE_URL} rh-ods - ${size}= Get Length ${matches} - IF ${size}>0 - ${domain}= Get From List ${matches} 0 - IF "${domain}" == "rh-ods" - RETURN ${TRUE} - END +Is Cluster Type Managed + [Documentation] Find the cluster type based on output of the infrastructure of the cluster + ... Returns ${TRUE} if cluster type is Managed + ... Returns ${FALSE} if cluster type is Self-Managed + ${rc} ${output}= Run And Return Rc And Output + ... oc get infrastructure cluster -o jsonpath='{.status.platformStatus.*.resourceTags[?(@.key=="red-hat-managed")].value}' + Should Be Equal As Integers ${rc} 0 + IF "${output}" == "true" + RETURN ${TRUE} ELSE RETURN ${FALSE} END