Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve the option to upgrade from a previous rhoai version to a newer one on selfmanaged cluster #2011

Open
wants to merge 2 commits into
base: releases/2.10.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ods_ci/tasks/Resources/RHODS_OLM/install/cs_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ items:
namespace: <OPERATOR_NAMESPACE>
spec:
channel: <UPDATE_CHANNEL>
installPlanApproval: Automatic
installPlanApproval: <INSTALL_PLAN_APPROVAL>
name: <OPERATOR_NAME>
source: <CATALOG_SOURCE>
sourceNamespace: openshift-marketplace
startingCSV: <STARTING_CSV>
- apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
Expand Down
6 changes: 4 additions & 2 deletions ods_ci/tasks/Resources/RHODS_OLM/install/install.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ Resource oc_install.robot


*** Keywords ***
Installing RHODS Operator ${image_url}
Installing RHODS Operator
[Documentation] Installing the RHOAI operator
[Arguments] ${image_url} ${install_plan_approval} ${rhoai_version}=${EMPTY}
${is_operator_installed} = Is RHODS Installed
IF not ${is_operator_installed} Run Keywords
... Log Installing RHODS operator in ${cluster_type} console=yes AND
... Set Suite Variable ${image_url} AND
... Set Test Variable ${RHODS_OSD_INSTALL_REPO} AND
... Install RHODS ${cluster_type} ${image_url}
... Install RHODS ${cluster_type} ${image_url} ${install_plan_approval} ${rhoai_version}

RHODS Operator Should Be installed
Verify RHODS Installation
Expand Down
64 changes: 41 additions & 23 deletions ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,49 @@
${AUTHORINO_OP_NAME}= authorino-operator
${AUTHORINO_SUB_NAME}= authorino-operator
${AUTHORINO_CHANNEL_NAME}= tech-preview-v1
${RHODS_CSV_DISPLAY}= Red Hat OpenShift AI
${ODH_CSV_DISPLAY}= Open Data Hub Operator
${CUSTOM_MANIFESTS}= ${EMPTY}
${RHODS_OSD_INSTALL_REPO} ${EMPTY}

Check warning

Code scanning / Robocop

The assignment sign is not consistent inside the variables section. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning

The assignment sign is not consistent inside the variables section. Expected '=' but got '' instead
${OLM_DIR} rhodsolm

Check warning

Code scanning / Robocop

The assignment sign is not consistent inside the variables section. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning

The assignment sign is not consistent inside the variables section. Expected '=' but got '' instead
@{SUPPORTED_TEST_ENV} AWS AWS_DIS GCP PSI PSI_DIS ROSA IBM_CLOUD CRC AZURE ROSA_HCP

Check warning

Code scanning / Robocop

The assignment sign is not consistent inside the variables section. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning

The assignment sign is not consistent inside the variables section. Expected '=' but got '' instead
bdattoma marked this conversation as resolved.
Show resolved Hide resolved
${install_plan_approval} Manual

Check warning

Code scanning / Robocop

Section variable '{{ variable_name }}' name should be uppercase Warning

Section variable '${install_plan_approval}' name should be uppercase

Check warning

Code scanning / Robocop

The assignment sign is not consistent inside the variables section. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning

The assignment sign is not consistent inside the variables section. Expected '=' but got '' instead
${rhoai_version} ${EMPTY}

Check warning

Code scanning / Robocop

Section variable '{{ variable_name }}' name should be uppercase Warning

Section variable '${rhoai_version}' name should be uppercase

Check warning

Code scanning / Robocop

The assignment sign is not consistent inside the variables section. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning

The assignment sign is not consistent inside the variables section. Expected '=' but got '' instead

*** Keywords ***
Install RHODS
[Arguments] ${cluster_type} ${image_url}
[Arguments] ${cluster_type} ${image_url} ${install_plan_approval} ${rhoai_version}=${EMPTY} ${is_upgrade}=False

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning

Line is too long (128/120)
Log To Console Start installing RHOAI with:\n\- cluster type: ${cluster_type}\n\- image_url: ${image_url}\n\- update_channel: ${UPDATE_CHANNEL}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning

Line is too long (148/120)
Log To Console \- rhoai_version: ${rhoai_version}\n\- is_upgrade: ${is_upgrade}\n\- install_plan_approval: ${install_plan_approval}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning

Line is too long (136/120)
Assign Vars According To Product
Install Kserve Dependencies
Clone OLM Install Repo
IF "${PRODUCT}" == "ODH"
${csv_display_name} = Set Variable ${ODH_CSV_DISPLAY}
ELSE
${csv_display_name} = Set Variable ${RHODS_CSV_DISPLAY}
END
IF "${cluster_type}" == "selfmanaged"
IF "${TEST_ENV}" in "${SUPPORTED_TEST_ENV}" and "${INSTALL_TYPE}" == "CLi"
Install RHODS In Self Managed Cluster Using CLI ${cluster_type} ${image_url}
ELSE IF "${TEST_ENV}" in "${SUPPORTED_TEST_ENV}" and "${INSTALL_TYPE}" == "OperatorHub"
${file_path} = Set Variable tasks/Resources/RHODS_OLM/install/
Copy File source=${file_path}cs_template.yaml destination=${file_path}cs_apply.yaml
IF "${PRODUCT}" == "ODH"
Run sed -i'' -e 's/<CATALOG_SOURCE>/community-operators/' ${file_path}cs_apply.yaml
IF "${is_upgrade}" == "False"
${file_path} = Set Variable tasks/Resources/RHODS_OLM/install/
${starting_csv} = Set Variable ""
IF "${rhoai_version}" != "${EMPTY}"
Log To Console Start installing "${OPERATOR_NAME}" with version: ${rhoai_version}
${starting_csv} = Set Variable ${OPERATOR_DEPLOYMENT_NAME}.${rhoai_version}
END
Copy File source=${file_path}cs_template.yaml destination=${file_path}cs_apply.yaml
Run sed -i'' -e 's/<CATALOG_SOURCE>/${CATALOG_SOURCE}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<OPERATOR_NAME>/${OPERATOR_DEPLOYMENT_NAME}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<OPERATOR_NAMESPACE>/${OPERATOR_NAMESPACE}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<UPDATE_CHANNEL>/${UPDATE_CHANNEL}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<STARTING_CSV>/${starting_csv}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<INSTALL_PLAN_APPROVAL>/${install_plan_approval}/' ${file_path}cs_apply.yaml
Oc Apply kind=List src=${file_path}cs_apply.yaml
Remove File ${file_path}cs_apply.yml
ELSE
Run sed -i'' -e 's/<CATALOG_SOURCE>/redhat-operators/' ${file_path}cs_apply.yaml
${patch_update_channel_status} = Run And Return Rc oc patch subscription ${OPERATOR_DEPLOYMENT_NAME} -n ${OPERATOR_NAMESPACE} --type='json' -p='[{"op": "replace", "path": "/spec/channel", "value": ${UPDATE_CHANNEL}}]' #robocop:disable
Should Be Equal As Integers ${patch_update_channel_status} 0 msg=Error while changing the UPDATE_CHANNEL

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning

Line is too long (127/120)
Sleep 30s reason=wait for thirty seconds until old CSV is removed and new one is ready
END
IF "${rhoai_version}" != "${EMPTY}"
Wait For Installplan And Approve It ${OPERATOR_NAMESPACE} ${OPERATOR_DEPLOYMENT_NAME} ${rhoai_version}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning

Line is too long (125/120)
END
Run sed -i'' -e 's/<OPERATOR_NAME>/${OPERATOR_NAME}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<OPERATOR_NAMESPACE>/${OPERATOR_NAMESPACE}/' ${file_path}cs_apply.yaml
Run sed -i'' -e 's/<UPDATE_CHANNEL>/${UPDATE_CHANNEL}/' ${file_path}cs_apply.yaml
Oc Apply kind=List src=${file_path}cs_apply.yaml
Remove File ${file_path}cs_apply.yml
ELSE
FAIL Provided test environment and install type is not supported
END
Expand All @@ -71,15 +84,15 @@
FAIL Provided test environment is not supported
END
END
Wait Until Csv Is Ready display_name=${csv_display_name} operators_namespace=${OPERATOR_NAMESPACE}
Wait Until Csv Is Ready display_name=${OPERATOR_NAME} operators_namespace=${OPERATOR_NAMESPACE}

Verify RHODS Installation
Set Global Variable ${DASHBOARD_APP_NAME} ${PRODUCT.lower()}-dashboard
Log Verifying RHODS installation console=yes
Log To Console Waiting for all RHODS resources to be up and running
Wait For Pods Numbers 1
... namespace=${OPERATOR_NAMESPACE}
... label_selector=name=${OPERATOR_NAME}
... label_selector=name=${OPERATOR_DEPLOYMENT_NAME}
... timeout=2000
Wait For Pods Status namespace=${OPERATOR_NAMESPACE} timeout=1200
Log Verified ${OPERATOR_NAMESPACE} console=yes
Expand Down Expand Up @@ -190,9 +203,14 @@

Clone OLM Install Repo
[Documentation] Clone OLM git repo
${return_code} ${output} Run And Return Rc And Output git clone ${RHODS_OSD_INSTALL_REPO} ${EXECDIR}/${OLM_DIR}
Log To Console ${output}
Should Be Equal As Integers ${return_code} 0
${status} = Run Keyword And Return Status Directory Should Exist ${EXECDIR}/${OLM_DIR}
IF ${status}
Log To Console "The directory ${EXECDIR}/${OLM_DIR} already exist, skipping clone of the repo."
ELSE
${return_code} ${output} Run And Return Rc And Output git clone ${RHODS_OSD_INSTALL_REPO} ${EXECDIR}/${OLM_DIR}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning

Line is too long (127/120)

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning

The assignment sign is not consistent within the file. Expected ' =' but got '' instead
Log To Console ${output}
Should Be Equal As Integers ${return_code} 0
END

Install RHODS In Self Managed Cluster Using CLI
[Documentation] Install rhods on self managed cluster using cli
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Check A RHODS Family Operator Is Installed
[Arguments] ${namespace} ${subscription}
Log Getting CSV from subscription ${subscription} namespace ${namespace} console=yes
${rc} ${current_csv_name} = Run And Return Rc And Output
... oc get subscription ${subscription} -n ${namespace} -ojson | jq '.status.currentCSV' | tr -d '"'
... oc get subscription ${subscription} -n ${namespace} -ojson | jq '.status.installedCSV' | tr -d '"'
Log Got CSV ${current_csv_name} from subscription ${subscription}, result: ${rc} console=yes
IF "${rc}" == "0" and "${current_csv_name}" != "${EMPTY}"
${result} = Run Keyword And Return Status
Expand Down
17 changes: 7 additions & 10 deletions ods_ci/tasks/Tasks/rhods_olm.robot
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
***Variables***
${cluster_type} selfmanaged
${image_url} ${EMPTY}
${RHODS_OSD_INSTALL_REPO} None
@{SUPPORTED_TEST_ENV} AWS AWS_DIS GCP PSI PSI_DIS ROSA IBM_CLOUD CRC AZURE ROSA_HCP
${TEST_ENV} AWS
${INSTALL_TYPE} OperatorHub
${UPDATE_CHANNEL} odh-nightlies
${OLM_DIR} rhodsolm
${RHODS_VERSION} None

*** Tasks ***
Expand All @@ -24,15 +21,15 @@
IF "${PRODUCT}" == "ODH"
Set Global Variable ${OPERATOR_NAMESPACE} opendatahub-operators
IF "${UPDATE_CHANNEL}" == "odh-nightlies"
Set Global Variable ${OPERATOR_NAME} rhods-operator
Set Global Variable ${OPERATOR_DEPLOYMENT_NAME} rhods-operator

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
ELSE
Set Global Variable ${OPERATOR_NAME} opendatahub-operator
Set Global Variable ${OPERATOR_DEPLOYMENT_NAME} opendatahub-operator

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
END
ELSE
Set Global Variable ${OPERATOR_NAME} rhods-operator
Set Global Variable ${OPERATOR_DEPLOYMENT_NAME} rhods-operator

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
END
Given Selected Cluster Type ${cluster_type}
When Installing RHODS Operator ${image_url}
When Installing RHODS Operator ${image_url} ${install_plan_approval} ${RHOAI_VERSION}
Then RHODS Operator Should Be Installed
[Teardown] Install Teardown

Expand All @@ -41,12 +38,12 @@
IF "${PRODUCT}" == "ODH"
Set Global Variable ${OPERATOR_NAMESPACE} opendatahub-operators
IF "${UPDATE_CHANNEL}" == "odh-nightlies"
Set Global Variable ${OPERATOR_NAME} rhods-operator
Set Global Variable ${OPERATOR_DEPLOYMENT_NAME} rhods-operator

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
ELSE
Set Global Variable ${OPERATOR_NAME} opendatahub-operator
Set Global Variable ${OPERATOR_DEPLOYMENT_NAME} opendatahub-operator

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
END
ELSE
Set Global Variable ${OPERATOR_NAME} rhods-operator
Set Global Variable ${OPERATOR_DEPLOYMENT_NAME} rhods-operator

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note

Set Global Variable can be replaced with VAR
END
Given Selected Cluster Type ${cluster_type}
When Uninstalling RHODS Operator
Expand Down
22 changes: 19 additions & 3 deletions ods_ci/tests/Resources/Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Get RHODS Version
${RHODS_VERSION}= Run oc get csv -n ${OPERATOR_NAMESPACE} | grep "opendatahub" | awk -F ' {2,}' '{print $3}'
END
END
Log Product:${PRODUCT} Version:${RHODS_VERSION}
Log To Console Product:${PRODUCT} Version:${RHODS_VERSION}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do both things by adding "console=yes" in the Log parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the descriptive keyword
Unless there is an advantage by using the param "console=yes"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log to console doesn't log in the HTML report no? while Log with console=yes does both

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know :)
I'll update it.
Thank you!!

RETURN ${RHODS_VERSION}

#robocop: disable: line-too-long
Expand All @@ -176,17 +176,33 @@ Get CodeFlare Version
#robocop: disable: line-too-long
Wait Until Csv Is Ready
[Documentation] Waits ${timeout} for Operators CSV '${display_name}' to have status phase 'Succeeded'
[Arguments] ${display_name} ${timeout}=10m ${operators_namespace}=openshift-operators
[Arguments] ${display_name} ${timeout}=10m ${operators_namespace}=openshift-operators ${check_interval}=5s
Log Waiting ${timeout} for Operator CSV '${display_name}' in ${operators_namespace} to have status phase 'Succeeded' console=yes
WHILE True limit=${timeout}
... on_limit_message=${timeout} Timeout exceeded waiting for CSV '${display_name}' to be created
Sleep ${check_interval}
${csv_created}= Run Process oc get csv --no-headers -n ${operators_namespace} | awk '/${display_name}/ {print \$1}' shell=yes
IF "${csv_created.stdout}" == "${EMPTY}" CONTINUE
Log To Console The Result of csv_created Output is: ${csv_created.stdout} RC: ${csv_created.rc}
IF '$csv_created.stdout' == '${EMPTY}' CONTINUE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why changing from "${csv_created.stdout}" to '$csv_created.stdout'? it is a regular string check, the original version should work just fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it because of this error:

Variables in the original expression ''${csv_created.stdout}' == '${EMPTY}'' were resolved before the expression was evaluated. Try using ''$csv_created.stdout' == '$EMPTY'' syntax to avoid that. See Evaluating Expressions appendix in Robot Framework User Guide for more details.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this is not a new code, was it broken before?

# In case of upgrade there are 2 operators, we need to wait until only one will be available
${lines}= Split String ${csv_created.stdout} \n
${line_count}= Get Length ${lines}
IF ${line_count} > 1 CONTINUE
${csv_ready}= Run Process
... oc wait --timeout\=${timeout} --for jsonpath\='{.status.phase}'\=Succeeded csv -n ${operators_namespace} ${csv_created.stdout} shell=yes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm shouldn't you pass the CSV name as well?

Log To Console The Result of csv_ready Output is: ${csv_ready.stdout} RC: ${csv_ready.rc}
IF ${csv_ready.rc} == ${0} BREAK
END

Check If Resource Exists By Command Output
[Documentation] Check if resource exists with specific command,
... Fail if the output is empty or contains the string 'No resources found'
[Arguments] ${command}
${result}= Run Process ${command} shell=True stdout=PIPE
Log To Console The Result of Check If Resource Exists By Command Output is: ${result.stdout} RC: ${result.rc}
Should Not Be Empty ${result.stdout}
Should Not Contain ${result.stdout} 'No resources found'

Get Cluster ID
[Documentation] Retrieves the ID of the currently connected cluster
${cluster_id}= Run oc get clusterversion -o json | jq .items[].spec.clusterID
Expand Down
29 changes: 28 additions & 1 deletion ods_ci/tests/Resources/OCP.resource
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,34 @@
Should Be Equal "${rc}" "0" msg=${value}
IF "${value}" != "${EMPTY}"
Log To Console ${resource_type} ${resource_name} in the namespace ${namespace} attribute ${attribute_path} value is ${value}
ELSE
ELSE
Log To Console ${resource_type} ${resource_name} in the namespace ${namespace} attribute ${attribute_path} value is EMPTY

Check warning

Code scanning / Robocop

Keyword '{{ keyword_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}) Warning test

Keyword 'Wait For Installplan And Approve It' has too many keywords inside (11/10)
END

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (123/120)
RETURN ${value}

Wait For Installplan And Approve It

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (126/120)
[Documentation] Wait for the operator's installplan to appear then approve it in case of Manual installplan approval
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WHILE "${installplan_name}" == "${EMPTY}" limit=5m

could you check if we could re-use code instead of creating a new keyword?

[Arguments] ${namespace} ${operator_name} ${operator_version}=${EMPTY}

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (124/120)
${csv} = Evaluate '${operator_name}.${operator_version}' if '${operator_version}' else '${operator_name}'

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '=' but got ' =' instead

Check notice

Code scanning / Robocop

'{{ block_name }}' condition can be simplified Note test

'IF' condition can be simplified
Log To Console The csv is: ${csv}
Wait Until Keyword Succeeds 10m 5s Check If Resource Exists By Command Output oc get installplans -n ${namespace} -o yaml | grep "${csv}"

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (147/120)

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (153/120)
${installplan_name}= Run oc get subscription ${operator_name} -n ${namespace} -o json | jq '.status.installplan.name'
IF "${operator_version}" != "${EMPTY}"
${installplan_version_exist}= Run And Return Rc oc get installplan -n ${namespace} | grep "${operator_version}"
IF ${installplan_version_exist} != 0
${installplans}= Run oc get installplan -n ${namespace}
FAIL Failed to find installplan for operator: ${operator_name} version: ${operator_version}\nExisting installplans:\n${installplans}
END
END

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (152/120)

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '=' but got ' =' instead
${installplan_approval}= Get Resource Attribute ${namespace}

Check notice

Code scanning / Robocop

'{{ block_name }}' condition can be simplified Note test

'IF' condition can be simplified
... InstallPlan ${installplan_name} .spec.approval
Log To Console The installplan approval for: ${installplan_name} is ${installplan_approval}
IF "${installplan_approval}" == "Manual"
Log To Console Start approving the installplan: ${installplan_name}...
${patch_status} = Run And Return Rc oc patch installplan ${installplan_name} -n ${namespace} -p '{"spec":{"approved": true}}' --type=merge
IF ${patch_status} == 0
Log To Console Approving the installplan ${installplan_name} successfully!!
ELSE
Log To Console Failed to approving the installplan ${installplan_name}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not FAIL here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

END
END
14 changes: 2 additions & 12 deletions ods_ci/tests/Resources/Page/Operators/ISVs.resource
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,7 @@ Install ISV Operator From OperatorHub Via CLI # robocop: disable
Oc Apply kind=Subscription src=${operator_sub_filepath}
Wait Until Keyword Succeeds 1 min 0 sec
... Is Resource Present Subscription ${subscription_name} ${namespace} ${IS_PRESENT}
WHILE "${installplan_name}" == "${EMPTY}" limit=5m
${installplan_name}= Get Resource Attribute ${namespace}
... Subscription ${subscription_name} .status.installPlanRef.name
Sleep 20s
END
${installplan_approval}= Get Resource Attribute ${namespace}
... InstallPlan ${installplan_name} .spec.approval
IF "${installplan_approval}" == "Manual"
${return_code} ${out}= Run And Return Rc And Output oc patch installplan ${installplan_name} -n ${namespace} --type='json' -p '[{"op": "replace", "path": "/spec/approved", "value": true}]' #robocop:disable
Should Be Equal As Integers ${return_code} 0 msg=Error while approving installplan
END
Wait For Installplan And Approve It ${namespace} ${operator_name}

Create Operator Group
[Documentation] Creates the Operator Group object which might be needed by an operator.
Expand Down Expand Up @@ -83,7 +73,7 @@ Wait Until Operator Subscription Last Condition Is # robocop: disable
[Arguments] ${type} ${status} ${reason}
... ${subcription_name} ${namespace}=openshift-operators
... ${retry}=60
... ${retry_interval}=3s
... ${retry_interval}=5s
Wait Until Keyword Succeeds ${retry} times ${retry_interval} Operator Subscription Last Condition Should Be # robocop: disable
... type=${type} status=${status}
... reason=${reason} subcription_name=${subcription_name}
Expand Down
2 changes: 2 additions & 0 deletions ods_ci/tests/Resources/RHOSi.resource
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
IF "${PRODUCT}" == "RHODS"
Set Suite Variable ${OPERATOR_APPNAME} Red Hat OpenShift AI
Set Suite Variable ${OPERATOR_NAME} Red Hat OpenShift AI
Set Suite Variable ${CATALOG_SOURCE} redhat-operators

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 ${OPERATOR_DEPLOYMENT_NAME} rhods-operator
Set Suite Variable ${OPERATOR_LABEL_SELECTOR} name=rhods-operator
Set Suite Variable ${AUTHORINO_CR_NS} redhat-ods-applications-auth-provider
Expand All @@ -99,6 +100,7 @@
ELSE IF "${PRODUCT}" == "ODH"
Set Suite Variable ${OPERATOR_APPNAME} Open Data Hub Operator
Set Suite Variable ${OPERATOR_NAME} Open Data Hub Operator
Set Suite Variable ${CATALOG_SOURCE} community-operators

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 ${OPERATOR_DEPLOYMENT_NAME} opendatahub-operator-controller-manager
Set Suite Variable ${OPERATOR_LABEL_SELECTOR} control-plane=controller-manager
Set Suite Variable ${AUTHORINO_CR_NS} opendatahub-auth-provider
Expand Down
Loading
Loading