Skip to content

Commit

Permalink
Chore: Added sleep and timeout for while loop (#2029) (#2036)
Browse files Browse the repository at this point in the history
* Added sleep and timeout for while loop

* Added If else structure for Gettting Resource Attribute Kw for when
value comes empty
  • Loading branch information
CFSNM authored Nov 18, 2024
2 parents c2f1af4 + 9a5ae51 commit eb44589
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion ods_ci/tests/Resources/OCP.resource
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,9 @@ Get Resource Attribute
${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}
IF "${value}" != "${EMPTY}"
Log To Console ${resource_type} ${resource_name} in the namespace ${namespace} attribute ${attribute_path} value is ${value}
ELSE
Log To Console ${resource_type} ${resource_name} in the namespace ${namespace} attribute ${attribute_path} value is EMPTY
END
RETURN ${value}
10 changes: 7 additions & 3 deletions ods_ci/tests/Resources/Page/Operators/ISVs.resource
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ${FILES_RESOURCES_DIRPATH}= tests/Resources/Files
${SUBSCRIPTION_YAML_TEMPLATE_FILEPATH}= ${FILES_RESOURCES_DIRPATH}/isv-operator-subscription.yaml
${OPERATORGROUP_YAML_TEMPLATE_FILEPATH}= ${FILES_RESOURCES_DIRPATH}/isv-operator-group.yaml
${IS_PRESENT}= 0
${installplan_name} ${EMPTY}


*** Keywords ***
Expand All @@ -19,6 +20,7 @@ Install ISV Operator From OperatorHub Via CLI # robocop: disable
... ${channel}=stable ${catalog_source_name}=certified-operators
... ${cs_namespace}=openshift-marketplace ${operator_group_name}=${NONE}
... ${operator_group_ns}=${NONE} ${operator_group_target_ns}=${NONE}
[Timeout] 10 minutes
Log To Console message=Installing the '${operator_name}' Operator
IF "${operator_group_name}" != "${NONE}"
Create Operator Group name=${operator_group_name}
Expand All @@ -36,9 +38,11 @@ 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}
Sleep 30s
${installplan_name}= Get Resource Attribute ${namespace}
... Subscription ${subscription_name} .status.installPlanRef.name
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"
Expand Down

0 comments on commit eb44589

Please sign in to comment.