Skip to content

Commit

Permalink
fix: rework in some of the operator test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
CFSNM committed Sep 2, 2024
1 parent 15494a2 commit 31443e5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 54 deletions.
33 changes: 33 additions & 0 deletions ods_ci/tests/Resources/RHOSi.resource
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,36 @@ Assign Vars According To Product
Set Suite Variable ${DASHBOARD_LABEL_SELECTOR} app.kubernetes.io/part-of=dashboard
Set Suite Variable ${APPLICATIONS_NAMESPACE} opendatahub
END

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}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Suite Variable can be replaced with VAR
Set Suite Variable ${DSCI_RELEASE_NAME}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Suite Variable can be replaced with VAR
Set Suite Variable ${DSC_RELEASE_VERSION}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Suite Variable can be replaced with VAR
Set Suite Variable ${DSCI_RELEASE_VERSION}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Suite Variable can be replaced with VAR

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}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Suite Variable can be replaced with VAR

Check warning

Code scanning / Robocop

Test, suite and global variables should be uppercase Warning test

Test, suite and global variables should be uppercase
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,27 @@ 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 Setup Operator Setup
Suite Teardown RHOSi Teardown


*** Test Cases ***
Verify That DSC And DSCI Release.Name Attribute matches required value
Verify That DSC And DSCI Release.Name Attribute matches ${expected_release_name}

Check warning

Code scanning / Robocop

Not allowed character '{{ character }}' found in {{ block_name }} name Warning test

Not allowed character '.' found in 'Verify That DSC And DSCI Release.Name Attribute matches ${expected_release_name}' test case 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] 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
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] 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 '"'

Expand All @@ -62,6 +45,7 @@ Verify Odh-deployer Checks Cluster Platform Type
... Tier1
... ODS-1316
... AutomationBug
... Operator
${cluster_platform_type}= Fetch Cluster Platform Type
IF "${cluster_platform_type}" == "AWS" or "${cluster_platform_type}" == "OpenStack"
${odhdeployer_logs_content}= Set Variable
Expand All @@ -87,6 +71,7 @@ Verify That The Operator Pod Does Not Get Stuck After Upgrade
[Tags] Sanity
... Tier1
... ODS-818
... Operator
${operator_pod_info}= Fetch operator Pod Info
${length}= Get length ${operator_pod_info}
IF ${length} == 2
Expand All @@ -102,6 +87,7 @@ Verify Clean Up ODS Deployer Post-Migration
... ODS-1767
... Sanity
... AutomationBug
... Operator
${version_check} = Is RHODS Version Greater Or Equal Than 1.17.0
IF ${version_check} == False
Log Skipping test case as RHODS version is less than 1.17.0
Expand Down Expand Up @@ -155,6 +141,12 @@ Verify Clean Up ODS Deployer Post-Migration
Should Be Equal ${dashboardConfig[0]["spec"]["notebookController"]["pvcSize"]} 20Gi

*** Keywords ***
Operator Setup
[Documentation] Setup for the Operator tests
RHOSi Setup
Gather Release Attributes From DSC And DSCI
Set Expected Value For Release Name

Fetch Odh-deployer Pod Info
[Documentation] Fetches information about odh-deployer pod
... Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Verify that the must-gather image provides RHODS logs and info
... ODS-505
... Operator
... MustGather
... ExcludeOnODH
Get must-gather Logs
Verify logs for ${APPLICATIONS_NAMESPACE}
IF "${PRODUCT}" == "RHODS"
Expand Down
33 changes: 0 additions & 33 deletions ods_ci/tests/Tests/0200__rhoai_upgrade/0203__post_upgrade.robot
Original file line number Diff line number Diff line change
Expand Up @@ -285,39 +285,6 @@ 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
Expand Down

0 comments on commit 31443e5

Please sign in to comment.