From 6f0a1bb9c0219105d90668670889ab75458102aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Francisco=20San=20Nicol=C3=A1s=20Mart=C3=ADne?= =?UTF-8?q?z?= Date: Mon, 26 Aug 2024 15:27:57 +0200 Subject: [PATCH 1/2] Added new tests to validate release.name and release.version attributes of a dsc/dsci --- ods_ci/tests/Resources/OCP.resource | 9 +++ ods_ci/tests/Resources/ODS.robot | 1 + ods_ci/tests/Resources/RHOSi.resource | 2 + .../0101__installation/0108__operator.robot | 56 ++++++++++++++++ .../0203__post_upgrade.robot | 66 +++++++++++++++++++ 5 files changed, 134 insertions(+) diff --git a/ods_ci/tests/Resources/OCP.resource b/ods_ci/tests/Resources/OCP.resource index 5ecf8e551..464635b19 100644 --- a/ods_ci/tests/Resources/OCP.resource +++ b/ods_ci/tests/Resources/OCP.resource @@ -283,3 +283,12 @@ Apply OpenShift Configuration ${result}= Run Process ${command} stdin=${config} shell=True stdout=PIPE stderr=PIPE Should Be Equal As Strings ${result.rc} 0 The oc apply command failed Log ${result.stdout} + +Get Resource Attribute + [Documentation] Gets the value of an attribute of a specific resource + [Arguments] ${namespace} ${resource_type} ${resource_name} ${attribute_path} + ${rc} ${value}= Run And Return Rc And Output + ... oc get ${resource_type}/${resource_name} -n ${namespace} -o 'jsonpath={${attribute_path}}' + Should Be Equal "${rc}" "0" msg=${value} + Log To Console ${resource_type} ${resource_name} in the namespace ${namespace} attribute ${attribute_path} value is ${value} + RETURN ${value} diff --git a/ods_ci/tests/Resources/ODS.robot b/ods_ci/tests/Resources/ODS.robot index 7f2f80cb6..b552d3f4a 100644 --- a/ods_ci/tests/Resources/ODS.robot +++ b/ods_ci/tests/Resources/ODS.robot @@ -403,6 +403,7 @@ Wait For DSCI Ready State ${rc} ${output}= Run And Return Rc And Output ... oc wait --timeout=${wait_time} --for jsonpath='{.status.conditions[].reason}'=ReconcileCompleted -n ${namespace} dsci ${dsci} Should Be Equal "${rc}" "0" msg=${output} + Wait For DSC Conditions Reconciled [Documentation] Checks all DSC conditions to be successfully reconciled [Arguments] ${namespace} ${dsc_name} ${wait_time}=3m diff --git a/ods_ci/tests/Resources/RHOSi.resource b/ods_ci/tests/Resources/RHOSi.resource index 948431220..1996a3ae2 100644 --- a/ods_ci/tests/Resources/RHOSi.resource +++ b/ods_ci/tests/Resources/RHOSi.resource @@ -93,6 +93,7 @@ Assign Vars According To Product Set Suite Variable ${OPERATOR_DEPLOYMENT_NAME} rhods-operator Set Suite Variable ${OPERATOR_POD_CONTAINER_NAME} rhods-operator Set Suite Variable ${OPERATOR_LABEL_SELECTOR} name=rhods-operator + Set Suite Variable ${OPERATOR_SUBSCRIPTION_LABEL} operators.coreos.com/rhods-operator.redhat-ods-operator Set Suite Variable ${AUTHORINO_CR_NS} redhat-ods-applications-auth-provider Set Suite Variable ${DASHBOARD_DEPLOYMENT_NAME} rhods-dashboard Set Suite Variable ${DASHBOARD_LABEL_SELECTOR} app.kubernetes.io/part-of=rhods-dashboard @@ -103,6 +104,7 @@ Assign Vars According To Product Set Suite Variable ${OPERATOR_DEPLOYMENT_NAME} opendatahub-operator-controller-manager Set Suite Variable ${OPERATOR_POD_CONTAINER_NAME} manager Set Suite Variable ${OPERATOR_LABEL_SELECTOR} control-plane=controller-manager + Set Suite Variable ${OPERATOR_SUBSCRIPTION_LABEL} operators.coreos.com/rhods-operator.opendatahub-operators Set Suite Variable ${AUTHORINO_CR_NS} opendatahub-auth-provider Set Suite Variable ${DASHBOARD_DEPLOYMENT_NAME} odh-dashboard Set Suite Variable ${DASHBOARD_LABEL_SELECTOR} app.kubernetes.io/part-of=dashboard diff --git a/ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot b/ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot index a958f0a6d..ef1ed07e2 100644 --- a/ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot +++ b/ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot @@ -4,11 +4,66 @@ Documentation Post install test cases that verify OCP operator resources a Library OpenShiftLibrary Resource ../../../../Resources/ODS.robot Resource ../../../../Resources/RHOSi.resource +Resource ../../../../Resources/OCP.resource +Resource ../../../../Resources/Common.robot +Resource ../../../../../tasks/Resources/RHODS_OLM/install/oc_install.robot Suite Setup RHOSi Setup Suite Teardown RHOSi Teardown +*** Variables *** +${ODH_RELEASE_NAME}= Open Data Hub +${RHOAI_SELFMANAGED_RELEASE_NAME}= OpenShift AI Self-Managed +${RHOAI_MANAGED_RELEASE_NAME}= OpenShift AI Cloud Service +${RELEASE_NAME_ATTRIBUTE_PATH}= .status.release.name +${RELEASE_VERSION_ATTRIBUTE_PATH}= .status.release.version + + *** Test Cases *** +Verify That DSC And DSCI Release.Name Attribute matches required value + [Documentation] Tests the release.name attribute from the DSC and DSCI matches the desired value. + ... ODH: Open Data Hub + ... RHOAI managed: OpenShift AI Cloud Service + ... RHOAI selfmanaged: OpenShift AI Self-Managed + [Tags] Smoke + ... Operator + ... RHOAIENG-9760 + ${DSC_RELEASE_NAME}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... DataScienceCluster ${DSC_NAME} ${RELEASE_NAME_ATTRIBUTE_PATH} + ${DSCI_RELEASE_NAME}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... DSCInitialization ${DSCI_NAME} ${RELEASE_NAME_ATTRIBUTE_PATH} + + IF "${PRODUCT}" == "RHODS" + Run Keyword If RHODS Is Self-Managed Should Be Equal As Strings ${DSC_RELEASE_NAME} ${RHOAI_SELFMANAGED_RELEASE_NAME} + Run Keyword If RHODS Is Self-Managed Should Be Equal As Strings ${DSCI_RELEASE_NAME} ${RHOAI_SELFMANAGED_RELEASE_NAME} + Run Keyword If RHODS Is Managed Should Be Equal As Strings ${DSC_RELEASE_NAME} ${RHOAI_MANAGED_RELEASE_NAME} + Run Keyword If RHODS Is Managed Should Be Equal As Strings ${DSCI_RELEASE_NAME} ${RHOAI_MANAGED_RELEASE_NAME} + ELSE IF "${PRODUCT}" == "ODH" + Should Be Equal As Strings ${DSC_RELEASE_NAME} ${ODH_RELEASE_NAME} + Should Be Equal As Strings ${DSCI_RELEASE_NAME} ${ODH_RELEASE_NAME} + END + +Verify That DSC And DSCI Release.Version Attribute matches the value in the subscription + [Documentation] Tests the release.version attribute from the DSC and DSCI matches the value in the subscription. + [Tags] Smoke + ... Operator + ... RHOAIENG-8082 + ${DSC_RELEASE_VERSION}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... DataScienceCluster ${DSC_NAME} ${RELEASE_VERSION_ATTRIBUTE_PATH} + ${DSCI_RELEASE_VERSION}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... DSCInitialization ${DSCI_NAME} ${RELEASE_VERSION_ATTRIBUTE_PATH} + + ${rc} ${csv_name}= Run And Return Rc And Output + ... oc get subscription -n ${OPERATOR_NAMESPACE} -l ${OPERATOR_SUBSCRIPTION_LABEL} -ojson | jq '.items[0].status.currentCSV' | tr -d '"' + + Should Be Equal As Integers ${rc} ${0} ${rc} + + ${csv_version}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... ClusterServiceVersion ${csv_name} .spec.version + + Should Be Equal As Strings ${DSC_RELEASE_VERSION} ${csv_version} + Should Be Equal As Strings ${DSCI_RELEASE_VERSION} ${csv_version} + Verify Odh-deployer Checks Cluster Platform Type [Documentation] Verifies if odh-deployer checks the platform type of the cluster before installing [Tags] Sanity @@ -48,6 +103,7 @@ Verify That The Operator Pod Does Not Get Stuck After Upgrade Log Error And Fail Pods When Pods Were Terminated ${operator_pod_info} Opertator Pod Stuck END END + Verify Clean Up ODS Deployer Post-Migration [Documentation] Verifies that resources unused are cleaned up after migration [Tags] Tier1 diff --git a/ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot b/ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot index 899b74721..92f2bf611 100644 --- a/ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot +++ b/ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot @@ -3,6 +3,8 @@ Documentation Test Suite for Upgrade testing,to be run after the upgrade Library OpenShiftLibrary Resource ../../Resources/RHOSi.resource Resource ../../Resources/ODS.robot +Resource ../../Resources/OCP.resource +Resource ../../../tasks/Resources/RHODS_OLM/install/oc_install.robot Resource ../../Resources/Page/ODH/ODHDashboard/ODHDashboard.resource Resource ../../Resources/Page/ODH/ODHDashboard/ODHDashboardResources.resource Resource ../../Resources/Page/ODH/ODHDashboard/ODHModelServing.resource @@ -35,6 +37,11 @@ ${MODEL_NAME}= test-model ${MODEL_CREATED}= ${FALSE} ${RUNTIME_NAME}= Model Serving Test ${DW_PROJECT_CREATED}= False +${ODH_RELEASE_NAME}= Open Data Hub +${RHOAI_SELFMANAGED_RELEASE_NAME}= OpenShift AI Self-Managed +${RHOAI_MANAGED_RELEASE_NAME}= OpenShift AI Cloud Service +${RELEASE_NAME_ATTRIBUTE_PATH}= .status.release.name +${RELEASE_VERSION_ATTRIBUTE_PATH}= .status.release.version *** Test Cases *** @@ -212,6 +219,30 @@ Verify that the must-gather image provides RHODS logs and info [Teardown] Cleanup must-gather Logs +Verify That DSC And DSCI Release.Name Attribute matches ${expected_release_name} + [Documentation] Tests the release.name attribute from the DSC and DSCI matches the desired value. + ... ODH: Open Data Hub + ... RHOAI managed: OpenShift AI Cloud Service + ... RHOAI selfmanaged: OpenShift AI Self-Managed + [Tags] Upgrade + Should Be Equal As Strings ${DSC_RELEASE_NAME} ${expected_release_name} + Should Be Equal As Strings ${DSCI_RELEASE_NAME} ${expected_release_name} + +Verify That DSC And DSCI Release.Version Attribute matches the value in the subscription + [Documentation] Tests the release.version attribute from the DSC and DSCI matches the value in the subscription. + [Tags] Upgrade + ${rc} ${csv_name}= Run And Return Rc And Output + ... oc get subscription -n ${OPERATOR_NAMESPACE} -l ${OPERATOR_SUBSCRIPTION_LABEL} -ojson | jq '.items[0].status.currentCSV' | tr -d '"' + + Should Be Equal As Integers ${rc} ${0} ${rc} + + ${csv_version}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... ClusterServiceVersion ${csv_name} .spec.version + + Should Be Equal As Strings ${DSC_RELEASE_VERSION} ${csv_version} + Should Be Equal As Strings ${DSCI_RELEASE_VERSION} ${csv_version} + + *** Keywords *** Dashboard Suite Setup [Documentation] Basic suite setup @@ -259,7 +290,42 @@ Managed RHOAI Upgrade Test Teardown @{list_values} = Create List 1 Run Keyword And Warn On Failure Should Contain ${list_values} ${resp.json()["data"]["result"][0]["value"][-1]} +Gather Release Attributes From DSC And DSCI + [Documentation] Gathers the release.name and release.value attributes from the dsc and dsci + ${DSC_RELEASE_NAME}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... DataScienceCluster ${DSC_NAME} ${RELEASE_NAME_ATTRIBUTE_PATH} + ${DSCI_RELEASE_NAME}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... DSCInitialization ${DSCI_NAME} ${RELEASE_NAME_ATTRIBUTE_PATH} + ${DSC_RELEASE_VERSION}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... DataScienceCluster ${DSC_NAME} ${RELEASE_VERSION_ATTRIBUTE_PATH} + ${DSCI_RELEASE_VERSION}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ... DSCInitialization ${DSCI_NAME} ${RELEASE_VERSION_ATTRIBUTE_PATH} + + Set Suite Variable ${DSC_RELEASE_NAME} + Set Suite Variable ${DSCI_RELEASE_NAME} + Set Suite Variable ${DSC_RELEASE_VERSION} + Set Suite Variable ${DSCI_RELEASE_VERSION} + +Set Expected Value For Release Name + [Documentation] Sets the expected value for release.name attribute from the DSC and DSCI. + ... ODH: Open Data Hub + ... RHOAI managed: OpenShift AI Cloud Service + ... RHOAI selfmanaged: OpenShift AI Self-Managed + IF "${PRODUCT}" == "RHODS" + IF ${IS_SELF_MANAGED} + ${expected_release_name}= Set Variable ${RHOAI_SELFMANAGED_RELEASE_NAME} + ELSE + ${expected_release_name}= Set Variable ${RHOAI_MANAGED_RELEASE_NAME} + END + ELSE IF "${PRODUCT}" == "ODH" + ${expected_release_name}= Set Variable ${ODH_RELEASE_NAME} + END + + Set Suite Variable ${expected_release_name} + Upgrade Suite Setup [Documentation] Set of action to run as Suite setup ${IS_SELF_MANAGED}= Is RHODS Self-Managed Set Suite Variable ${IS_SELF_MANAGED} + Gather Release Attributes From DSC And DSCI + Set Expected Value For Release Name From 0b861e6da79b2bec6535c50af766b661a55ebb42 Mon Sep 17 00:00:00 2001 From: Cesar Francisco San Nicolas Martinez Date: Thu, 29 Aug 2024 13:55:37 +0200 Subject: [PATCH 2/2] Update ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marián Macik --- ods_ci/tests/Resources/ODS.robot | 4 ++-- ods_ci/tests/Resources/RHOSi.resource | 5 +++++ .../0101__installation/0108__operator.robot | 10 +--------- .../Tests/0200__rhoai_upgrade/0203__post_upgrade.robot | 5 ----- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/ods_ci/tests/Resources/ODS.robot b/ods_ci/tests/Resources/ODS.robot index b552d3f4a..9d44ca2d2 100644 --- a/ods_ci/tests/Resources/ODS.robot +++ b/ods_ci/tests/Resources/ODS.robot @@ -399,14 +399,14 @@ Wait Until Operator Ready Wait For DSCI Ready State [Documentation] Wait for DSCI to reconciled to be complete - [Arguments] ${dsci} ${namespace} ${wait_time}=2m + [Arguments] ${dsci} ${namespace} ${wait_time}=6m ${rc} ${output}= Run And Return Rc And Output ... oc wait --timeout=${wait_time} --for jsonpath='{.status.conditions[].reason}'=ReconcileCompleted -n ${namespace} dsci ${dsci} Should Be Equal "${rc}" "0" msg=${output} Wait For DSC Conditions Reconciled [Documentation] Checks all DSC conditions to be successfully reconciled - [Arguments] ${namespace} ${dsc_name} ${wait_time}=3m + [Arguments] ${namespace} ${dsc_name} ${wait_time}=6m ${rc} ${out}= Run And Return Rc And Output ... oc wait --timeout=${wait_time} --for jsonpath='{.status.conditions[].reason}'=ReconcileCompleted -n ${namespace} dsc ${dsc_name} # robocop: disable Should Be Equal As Integers ${rc} ${0} diff --git a/ods_ci/tests/Resources/RHOSi.resource b/ods_ci/tests/Resources/RHOSi.resource index 1996a3ae2..38c86cd95 100644 --- a/ods_ci/tests/Resources/RHOSi.resource +++ b/ods_ci/tests/Resources/RHOSi.resource @@ -41,6 +41,11 @@ Resource Common.robot ... Generate Minio Random Credentials ... Get Minio Credentials ... Create Inference Access Token +${ODH_RELEASE_NAME}= Open Data Hub +${RHOAI_SELFMANAGED_RELEASE_NAME}= OpenShift AI Self-Managed +${RHOAI_MANAGED_RELEASE_NAME}= OpenShift AI Cloud Service +${RELEASE_NAME_ATTRIBUTE_PATH}= .status.release.name +${RELEASE_VERSION_ATTRIBUTE_PATH}= .status.release.version *** Keywords *** diff --git a/ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot b/ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot index ef1ed07e2..adc03f7d7 100644 --- a/ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot +++ b/ods_ci/tests/Tests/0100__platform/0101__deploy/0101__installation/0108__operator.robot @@ -11,14 +11,6 @@ Suite Setup RHOSi Setup Suite Teardown RHOSi Teardown -*** Variables *** -${ODH_RELEASE_NAME}= Open Data Hub -${RHOAI_SELFMANAGED_RELEASE_NAME}= OpenShift AI Self-Managed -${RHOAI_MANAGED_RELEASE_NAME}= OpenShift AI Cloud Service -${RELEASE_NAME_ATTRIBUTE_PATH}= .status.release.name -${RELEASE_VERSION_ATTRIBUTE_PATH}= .status.release.version - - *** Test Cases *** Verify That DSC And DSCI Release.Name Attribute matches required value [Documentation] Tests the release.name attribute from the DSC and DSCI matches the desired value. @@ -30,7 +22,7 @@ Verify That DSC And DSCI Release.Name Attribute matches required value ... RHOAIENG-9760 ${DSC_RELEASE_NAME}= Get Resource Attribute ${OPERATOR_NAMESPACE} ... DataScienceCluster ${DSC_NAME} ${RELEASE_NAME_ATTRIBUTE_PATH} - ${DSCI_RELEASE_NAME}= Get Resource Attribute ${OPERATOR_NAMESPACE} + ${DSCI_RELEASE_NAME}= Get Resource Attribute ${OPERATOR_NAMESPACE} ... DSCInitialization ${DSCI_NAME} ${RELEASE_NAME_ATTRIBUTE_PATH} IF "${PRODUCT}" == "RHODS" diff --git a/ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot b/ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot index 92f2bf611..cf872af64 100644 --- a/ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot +++ b/ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot @@ -37,11 +37,6 @@ ${MODEL_NAME}= test-model ${MODEL_CREATED}= ${FALSE} ${RUNTIME_NAME}= Model Serving Test ${DW_PROJECT_CREATED}= False -${ODH_RELEASE_NAME}= Open Data Hub -${RHOAI_SELFMANAGED_RELEASE_NAME}= OpenShift AI Self-Managed -${RHOAI_MANAGED_RELEASE_NAME}= OpenShift AI Cloud Service -${RELEASE_NAME_ATTRIBUTE_PATH}= .status.release.name -${RELEASE_VERSION_ATTRIBUTE_PATH}= .status.release.version *** Test Cases ***