Skip to content

Commit

Permalink
Added new tests to validate release.name and release.version attribut…
Browse files Browse the repository at this point in the history
…es of a dsc/dsci (red-hat-data-services#1750)

Related JIRAs:
- https://issues.redhat.com/browse/RHOAIENG-8082
- https://issues.redhat.com/browse/RHOAIENG-9760

Tested all the combinations:

odh/autotrigger-operator 63 64
rhoai/autotrigger-operator 51 52
rhoai-test-flow 10
  • Loading branch information
CFSNM authored Aug 30, 2024
2 parents 0a550c3 + 0b861e6 commit 9297253
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 2 deletions.
9 changes: 9 additions & 0 deletions ods_ci/tests/Resources/OCP.resource
Original file line number Diff line number Diff line change
Expand Up @@ -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}
5 changes: 3 additions & 2 deletions ods_ci/tests/Resources/ODS.robot
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +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}
Expand Down
7 changes: 7 additions & 0 deletions ods_ci/tests/Resources/RHOSi.resource
Original file line number Diff line number Diff line change
Expand Up @@ -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 ***
Expand Down Expand Up @@ -93,6 +98,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
Expand All @@ -103,6 +109,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,58 @@ 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


*** 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
Expand Down Expand Up @@ -48,6 +95,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
Expand Down
61 changes: 61 additions & 0 deletions ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -212,6 +214,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
Expand Down Expand Up @@ -259,7 +285,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

0 comments on commit 9297253

Please sign in to comment.