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

Automate Validate ServiceMeshControlPlaneAlreadyCreated Test Case #1762

Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b8bbe5d
Automate Validate ServiceMeshControlPlaneAlreadyCreated Test Case
asanzgom Aug 30, 2024
601222a
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Aug 30, 2024
da00f98
Added RHODS_OSD_INSTALL_REPO variable
asanzgom Aug 30, 2024
3f99bc5
changed to relative path on smcp template
asanzgom Aug 30, 2024
3b085ac
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Aug 30, 2024
2296ab1
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 2, 2024
6c04140
removed olminstall repo
asanzgom Sep 2, 2024
7b4abdf
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 4, 2024
8f1f664
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 5, 2024
4cd24cb
Added Test Case teardown + restored -p & -n flags
asanzgom Sep 5, 2024
38b1dbf
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 5, 2024
c8cd1fa
Removed OPERATOR_NAME from Assign Vars According To Product
asanzgom Sep 5, 2024
6d36f21
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 11, 2024
cf1f1c5
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 11, 2024
7c48f75
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 11, 2024
4af25ad
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 12, 2024
4b76708
Added check to rebuild DSC if previously existed on cluster
asanzgom Sep 12, 2024
31205d5
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 17, 2024
cb4618e
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 17, 2024
8db0156
Added workaround to get catalogsource
asanzgom Sep 17, 2024
28dc83d
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 23, 2024
cc3559c
Added save component statuses and recreate DSC logic
asanzgom Sep 23, 2024
df37b0a
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 24, 2024
54e611f
changed to use Load Json string + renamed kw to applying devflags
asanzgom Sep 24, 2024
dec7e54
Renamed kw to Generate CustomManifest in DSC YAML
asanzgom Sep 24, 2024
17c986c
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 24, 2024
1be5592
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 24, 2024
1171fce
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 25, 2024
3474104
added final check for smcp + rename kws + modelregistry field update
asanzgom Sep 25, 2024
ac4fccf
Merge branch 'master' into feature/Validate_ServiceMeshControlPlaneAl…
asanzgom Sep 25, 2024
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
20 changes: 20 additions & 0 deletions ods_ci/tasks/Resources/Files/smcp_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
kind: ServiceMeshControlPlane
apiVersion: maistra.io/v2
metadata:
name: basic
namespace: istio-system
spec:
version: v2.6
policy:
type: Istiod
telemetry:
type: Istiod
addons:
prometheus:
enabled: false
kiali:
enabled: false
grafana:
enabled: false
tracing:
type: None
94 changes: 67 additions & 27 deletions ods_ci/tasks/Resources/RHODS_OLM/install/oc_install.robot
Original file line number Diff line number Diff line change
Expand Up @@ -273,34 +273,48 @@

Apply DataScienceCluster CustomResource
[Documentation]
[Arguments] ${dsc_name}=${DSC_NAME}
[Arguments] ${dsc_name}=${DSC_NAME} ${custom}=False ${custom_cmp}=''

Check warning

Code scanning / Robocop

Keyword argument '{{ name }}' is not used Warning

Keyword argument '${custom_cmp}' is not used
${file_path} = Set Variable tasks/Resources/Files/
Log to Console Requested Configuration:
FOR ${cmp} IN @{COMPONENT_LIST}
TRY
Log To Console ${cmp} - ${COMPONENTS.${cmp}}
EXCEPT
Log To Console ${cmp} - Removed
END
END
Log to Console message=Creating DataScience Cluster using yml template
Create DataScienceCluster CustomResource Using Test Variables
Apply Custom Manifest in DataScienceCluster CustomResource Using Test Variables
${yml} = Get File ${file_path}dsc_apply.yml
Log To Console Applying DSC yaml
Log To Console ${yml}
${return_code} ${output} = Run And Return Rc And Output oc apply -f ${file_path}dsc_apply.yml
Log To Console ${output}
Should Be Equal As Integers ${return_code} 0 msg=Error detected while applying DSC CR
Remove File ${file_path}dsc_apply.yml
FOR ${cmp} IN @{COMPONENT_LIST}
IF $cmp not in $COMPONENTS
Component Should Not Be Enabled ${cmp}
ELSE IF '${COMPONENTS.${cmp}}' == 'Managed'
Component Should Be Enabled ${cmp}
ELSE IF '${COMPONENTS.${cmp}}' == 'Removed'
Component Should Not Be Enabled ${cmp}
END
IF ${custom} == True

Check notice

Code scanning / Robocop

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

'IF' condition can be simplified
Log to Console message=Creating DataScience Cluster using custom configuration

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning

Keyword name 'Log to Console' does not follow case convention
Create DataScienceCluster CustomResource Using Custom Configuration
Apply DevFlags in DataScienceCluster CustomResource

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning

Keyword name 'Apply DevFlags in DataScienceCluster CustomResource' does not follow case convention
${yml} = Get File ${file_path}dsc_apply.yml
Log To Console Applying DSC yaml
Log To Console ${yml}
${return_code} ${output} = Run And Return Rc And Output oc apply -f ${file_path}dsc_apply.yml
Log To Console ${output}
Should Be Equal As Integers ${return_code} 0 msg=Error detected while applying DSC CR
Remove File ${file_path}dsc_apply.yml
Wait For DSC Conditions Reconciled ${OPERATOR_NS} ${DSC_NAME}

Check warning

Code scanning / Robocop

Variable '{{ name }}' has inconsistent naming. First used as '{{ first_use }}' Warning

Variable '${DSC_NAME}' has inconsistent naming. First used as '${dsc_name}'
ELSE
Log to Console Requested Configuration:

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning

Keyword name 'Log to Console' does not follow case convention
FOR ${cmp} IN @{COMPONENT_LIST}
TRY
Log To Console ${cmp} - ${COMPONENTS.${cmp}}
EXCEPT
Log To Console ${cmp} - Removed
END
END
Log to Console message=Creating DataScience Cluster using yml template

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning

Keyword name 'Log to Console' does not follow case convention
Create DataScienceCluster CustomResource Using Test Variables
Apply Custom Manifest in DataScienceCluster CustomResource Using Test Variables

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning

Keyword name 'Apply Custom Manifest in DataScienceCluster CustomResource Using Test Variables' does not follow case convention
${yml} = Get File ${file_path}dsc_apply.yml
Log To Console Applying DSC yaml
Log To Console ${yml}
${return_code} ${output} = Run And Return Rc And Output oc apply -f ${file_path}dsc_apply.yml
Log To Console ${output}
Should Be Equal As Integers ${return_code} 0 msg=Error detected while applying DSC CR
Remove File ${file_path}dsc_apply.yml
FOR ${cmp} IN @{COMPONENT_LIST}
IF $cmp not in $COMPONENTS
Component Should Not Be Enabled ${cmp}
ELSE IF '${COMPONENTS.${cmp}}' == 'Managed'
Component Should Be Enabled ${cmp}
ELSE IF '${COMPONENTS.${cmp}}' == 'Removed'
Component Should Not Be Enabled ${cmp}
END
END
END

Create DataScienceCluster CustomResource Using Test Variables
Expand All @@ -324,6 +338,24 @@
END
END

Create DataScienceCluster CustomResource Using Custom Configuration
[Documentation]

Check warning

Code scanning / Robocop

Documentation of {{ block_name }} is empty Warning

Documentation of 'Create DataScienceCluster CustomResource Using Custom Configuration' Keyword is empty
[Arguments] ${dsc_name}=${DSC_NAME}
Log To Console ${custom_cmp}.items
${file_path} = Set Variable tasks/Resources/Files/
Copy File source=${file_path}dsc_template.yml destination=${file_path}dsc_apply.yml
Run sed -i'' -e 's/<dsc_name>/${dsc_name}/' ${file_path}dsc_apply.yml
FOR ${cmp} IN @{COMPONENT_LIST}
${value}= Get From Dictionary ${custom_cmp} ${cmp}

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
${status}= Get From Dictionary ${value} managementState

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 ${status}
IF '${status}' == 'Managed'
Run sed -i'' -e 's/<${cmp}_value>/Managed/' ${file_path}dsc_apply.yml
ELSE IF '${status}' == 'Removed'
Run sed -i'' -e 's/<${cmp}_value>/Removed/' ${file_path}dsc_apply.yml
END
END

Apply Custom Manifest in DataScienceCluster CustomResource Using Test Variables
[Documentation] Apply custom manifests to a DSC file
Log To Console Applying Custom Manifests
Expand All @@ -338,6 +370,14 @@
END
END

Apply DevFlags in DataScienceCluster CustomResource

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning

Keyword name 'Apply DevFlags in DataScienceCluster CustomResource' does not follow case convention
[Documentation] Apply devFlags to a DSC file
Log To Console Applying devFlags
${file_path} = Set Variable tasks/Resources/Files/
FOR ${cmp} IN @{COMPONENT_LIST}
Run sed -i'' -e "s|<${cmp}_devflags>||g" ${file_path}dsc_apply.yml
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it is setting the key as empty as it is by default

END

Wait For DataScienceCluster CustomResource To Be Ready
[Documentation] Wait for DataScienceCluster CustomResource To Be Ready
[Arguments] ${timeout}
Expand Down
2 changes: 1 addition & 1 deletion ods_ci/tests/Resources/ODS.robot
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ Delete RHODS Config Map

Wait Until Operator Ready
[Documentation] Wait for operator to be available/ready
[Arguments] ${operator_name} ${namespace} ${wait_time}=2m
[Arguments] ${operator_name} ${namespace} ${wait_time}=10m
${rc} ${output}= Run And Return Rc And Output
... oc wait --timeout=${wait_time} --for condition=available -n ${namespace} deploy/${operator_name}
Should Be Equal "${rc}" "0" msg=${output}
Expand Down
8 changes: 4 additions & 4 deletions ods_ci/tests/Resources/RHOSi.resource
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@
Assign Vars According To Product
[Documentation] Assign vars related to product
IF "${PRODUCT}" == "RHODS"
Set Suite Variable ${OPERATOR_APPNAME} Red Hat OpenShift AI
Set Suite Variable ${OPERATOR_NAME} Red Hat OpenShift AI
Set Suite Variable ${OPERATOR_APPNAME} "Red Hat OpenShift AI"
Fixed Show fixed Hide fixed

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_POD_CONTAINER_NAME} rhods-operator
Set Suite Variable ${OPERATOR_LABEL_SELECTOR} name=rhods-operator
Expand All @@ -105,10 +104,10 @@
Set Suite Variable ${DASHBOARD_DEPLOYMENT_NAME} rhods-dashboard
Set Suite Variable ${DASHBOARD_LABEL_SELECTOR} app.kubernetes.io/part-of=rhods-dashboard
Set Suite Variable ${APPLICATIONS_NAMESPACE} redhat-ods-applications
Set Suite Variable ${OPERATOR_SUBSCRIPTION_NAME} rhoai-operator-dev

Check notice

Code scanning / Robocop

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

Set Suite Variable can be replaced with VAR
Fixed Show fixed Hide fixed
Set Suite Variable ${MODEL_REGISTRY_NAMESPACE} rhoai-model-registries
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 ${OPERATOR_APPNAME} "Open Data Hub Operator"
Fixed Show fixed Hide fixed

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_POD_CONTAINER_NAME} manager
Set Suite Variable ${OPERATOR_LABEL_SELECTOR} control-plane=controller-manager
Expand All @@ -117,6 +116,7 @@
Set Suite Variable ${DASHBOARD_DEPLOYMENT_NAME} odh-dashboard
Set Suite Variable ${DASHBOARD_LABEL_SELECTOR} app.kubernetes.io/part-of=dashboard
Set Suite Variable ${APPLICATIONS_NAMESPACE} opendatahub
Set Suite Variable ${OPERATOR_SUBSCRIPTION_NAME} rhoai-operator-dev

Check notice

Code scanning / Robocop

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

Set Suite Variable can be replaced with VAR
Fixed Show fixed Hide fixed
Set Suite Variable ${MODEL_REGISTRY_NAMESPACE} odh-model-registries
END

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
*** Variables ***
${OPERATOR_NS} ${OPERATOR_NAMESPACE}
${DSCI_NAME} default-dsci
${DSC_NAME} default-dsc
${SERVICE_MESH_OPERATOR_NS} openshift-operators
${SERVICE_MESH_OPERATOR_DEPLOYMENT_NAME} istio-operator
${SERVICE_MESH_CR_NS} istio-system
${SERVICE_MESH_CR_NAME} data-science-smcp

${IS_PRESENT} 0
${IS_NOT_PRESENT} 1
${OLM_DIR} olm
${INSTALL_TYPE} CLi

Check notice

Code scanning / Robocop

Variable '{{ name }}' is assigned but not used Note test

Variable '${INSTALL_TYPE}' is assigned but not used
${TEST_ENV} PSI

Check notice

Code scanning / Robocop

Variable '{{ name }}' is assigned but not used Note test

Variable '${TEST_ENV}' is assigned but not used
${IS_PRESENT} 0
${IS_NOT_PRESENT} 1
${MSSG_REGEX} denied the request: only one service mesh may be installed per project/namespace

Check warning

Code scanning / Robocop

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

Line is too long (124/120)


*** Test Cases ***
Expand All @@ -32,7 +36,6 @@

[Teardown] Set Service Mesh State To Managed And Wait For CR Ready ${SERVICE_MESH_CR_NAME} ${SERVICE_MESH_CR_NS} ${OPERATOR_NS}


Validate Service Mesh State Unmanaged
[Documentation] The purpose of this Test Case is to validate Service Mesh state 'Unmanaged'.
... The operator will not recreate/update the Service Mesh CR if removed or changed.
Expand All @@ -58,15 +61,134 @@
[Teardown] Set Service Mesh State To Managed And Wait For CR Ready
... ${SERVICE_MESH_CR_NAME} ${SERVICE_MESH_CR_NS} ${OPERATOR_NS}

Validate Service Mesh Control Plane Already Created

Check warning

Code scanning / Robocop

Test case '{{ test_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}) Warning test

Test case 'Validate Service Mesh Control Plane Already Created' has too many keywords inside (11/10)
[Documentation] This Test Case validates that only one ServiceMeshControlPlane is allowed to be installed per project/namespace

Check warning

Code scanning / Robocop

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

Line is too long (134/120)
[Tags] Operator Tier3 RHOAIENG-2517
Fetch Image Url And Update Channel
Check Whether DSC Exists And Save Component Statuses
Fetch Cluster Type By Domain
IF "${CLUSTER_TYPE}" == "selfmanaged"
Uninstall RHODS In Self Managed Cluster
Create Smcp From Template
Install RHODS In Self Managed Cluster Using CLI ${CLUSTER_TYPE} ${IMAGE_URL}
ELSE IF "${CLUSTER_TYPE}" == "managed"
Uninstall RHODS In OSD
Create Smcp From Template
Install RHODS In Managed Cluster Using CLI ${CLUSTER_TYPE} ${IMAGE_URL}
END
Operator Deployment Should Be Ready
# Go check the Operator logs for the error message: denied the request: only one service mesh may be installed per project/namespace

Check warning

Code scanning / Robocop

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

Line is too long (136/120)
Verify Pod Logs Contain Error
[Teardown] Teardown Service Mesh Control Plane Already Created

Copy link
Contributor

Choose a reason for hiding this comment

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

We need a teardown method for the test just in case some step fails, so we are back to initial state, with ODH/RHOAI installed and working

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is the suite teardown
image

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Cesar, we need a teardown which restore the correct RHOAI status in the cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I can move it to the Suite Teardown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added Test Case Teardown


*** Keywords ***
Suite Setup
[Documentation] Suite Setup
RHOSi Setup
Wait Until Operator Ready ${SERVICE_MESH_OPERATOR_DEPLOYMENT_NAME} ${SERVICE_MESH_OPERATOR_NS}
Wait Until Operator Ready ${OPERATOR_DEPLOYMENT_NAME} ${OPERATOR_NS}
Wait For DSCI Ready State ${DSCI_NAME} ${OPERATOR_NS}
Wait Until Operator Ready ${OPERATOR_DEPLOYMENT_NAME} ${OPERATOR_NAMESPACE}
Wait For DSCI Ready State ${DSCI_NAME} ${OPERATOR_NAMESPACE}

Suite Teardown
[Documentation] Suite Teardown
RHOSi Teardown

Teardown Service Mesh Control Plane Already Created

Check warning

Code scanning / Robocop

Missing documentation in '{{ name }}' keyword Warning test

Missing documentation in 'Teardown Service Mesh Control Plane Already Created' keyword
# Cleanup the SMCP
Delete Smcp
# Cleanup Olminstall dir
Cleanup Olm Install Dir
IF ${DSC_EXISTS} == True

Check notice

Code scanning / Robocop

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

'IF' condition can be simplified
Fixed Show fixed Hide fixed
Apply DataScienceCluster CustomResource ${DSC_NAME} True ${custom_cmp}
END

Check Whether DSC Exists And Save Component Statuses

Check warning

Code scanning / Robocop

Missing documentation in '{{ name }}' keyword Warning test

Missing documentation in 'Check Whether DSC Exists And Save Component Statuses' keyword
${rc}= Run And Return Rc
... oc get datasciencecluster ${DSC_NAME}
IF ${rc} == 0

Check notice

Code scanning / Robocop

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

'IF' condition can be simplified
Fixed Show fixed Hide fixed
Set Global Variable ${DSC_EXISTS} True

Check notice

Code scanning / Robocop

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

Set Global Variable can be replaced with VAR
Fixed Show fixed Hide fixed
&{custom_cmp} = Create Dictionary

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 warning

Code scanning / Robocop

Local variable '{{ name }}' is overwritten before usage Warning test

Local variable '${custom_cmp}' is overwritten before usage

Check notice

Code scanning / Robocop

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

Create Dictionary can be replaced with VAR
${rc} ${out}= Run And Return Rc And Output
... oc get datasciencecluster ${DSC_NAME} -o jsonpath='{.spec.components}'
${custom_cmp}= Load Json String ${out}

Check notice

Code scanning / Robocop

Variable '{{ variable_name }}' may overwrite similar variable inside '{{ block_name }}' {{ block_type }}. Note that variables are case-insensitive, and also spaces and underscores are ignored. Note test

Variable '${custom_cmp}' may overwrite similar variable inside 'Check Whether DSC Exists And Save Component Statuses' Keyword. Note that variables are case-insensitive, and also spaces and underscores are ignored.
Set Test Variable ${custom_cmp} ${custom_cmp}

Check notice

Code scanning / Robocop

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

Set Test 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
ELSE

Check warning

Code scanning / Robocop

Trailing whitespace at the end of line Warning test

Trailing whitespace at the end of line
Set Global Variable ${DSC_EXISTS} False

Check notice

Code scanning / Robocop

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

Set Global Variable can be replaced with VAR
END

Fetch Image Url And Update Channel

Check warning

Code scanning / Robocop

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

Keyword 'Fetch Image Url And Update Channel' has too many keywords inside (12/10)
[Documentation] Fetch url for image and Update Channel
# Fetch subscription first
${rc} ${out}= Run And Return Rc And Output
... oc get subscription ${OPERATOR_SUBSCRIPTION_NAME} -n ${OPERATOR_NAMESPACE} -o jsonpath='{.spec.source}'
Should Be Equal As Integers ${rc} 0
Set Global Variable ${CS_NAME} ${out}

Check notice

Code scanning / Robocop

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

Set Global Variable can be replaced with VAR
${rc} ${out}= Run And Return Rc And Output
... oc get subscription ${OPERATOR_SUBSCRIPTION_NAME} -n ${OPERATOR_NAMESPACE} -o jsonpath='{.spec.sourceNamespace}'

Check warning

Code scanning / Robocop

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

Line is too long (123/120)
Should Be Equal As Integers ${rc} 0
Set Global Variable ${CS_NAMESPACE} ${out}

Check notice

Code scanning / Robocop

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

Set Global Variable can be replaced with VAR
# Get CatalogSource
${rc} ${out}= Run And Return Rc And Output
... oc get catalogsource ${CS_NAME} --namespace ${CS_NAMESPACE} -o jsonpath='{.spec.image}'
Should Be Equal As Integers ${rc} 0
Set Global Variable ${IMAGE_URL} ${out}
Fixed Show fixed Hide fixed

Check notice

Code scanning / Robocop

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

Set Global Variable can be replaced with VAR
${rc} ${out}= Run And Return Rc And Output
... oc get subscription ${OPERATOR_SUBSCRIPTION_NAME} --namespace ${OPERATOR_NS} -o jsonpath='{.spec.channel}'
Should Be Equal As Integers ${rc} 0
Set Global Variable ${UPDATE_CHANNEL} ${out}

Check notice

Code scanning / Robocop

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

Set Global Variable can be replaced with VAR
Copy link
Contributor

Choose a reason for hiding this comment

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

the same here, the subscription can have a different name if we dont use automations and we deploy the catalog source by hand


Fetch Cluster Type By Domain
[Documentation] This Keyword outputs the kind of cluster depending on the console URL domain
${matches}= Get Regexp Matches ${OCP_CONSOLE_URL} rh-ods
${domain}= Get From List ${matches} 0
IF "${domain}" == "rh-ods"
Set Global Variable ${CLUSTER_TYPE} selfmanaged

Check notice

Code scanning / Robocop

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

Set Global Variable can be replaced with VAR
ELSE
Set Global Variable ${CLUSTER_TYPE} managed

Check notice

Code scanning / Robocop

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

Set Global Variable can be replaced with VAR
END

Create Smcp From Template
[Documentation] Create a default ServiceMeshControlPlane from a template
${file_path}= Set Variable ./tasks/Resources/Files/
${return_code}= Run And Return Rc oc apply -f ${file_path}smcp_template.yml
Should Be Equal As Integers ${return_code} 0

Delete Smcp
[Documentation] Delete the ServiceMeshControlPlane already created
Run and Watch Command

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning test

Keyword name 'Run and Watch Command' does not follow case convention
... oc delete ServiceMeshControlPlane basic --namespace ${SERVICE_MESH_CR_NS} --force --grace-period=0

Operator Deployment Should Be Ready
[Documentation] Loop until the Operator deployment is ready
${rc}= Set Variable 1
TRY
WHILE ${rc} != 0 limit=10m

Check notice

Code scanning / Robocop

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

'WHILE' condition can be simplified
Sleep 5s
${rc} ${output}= Run And Return Rc And Output
... oc wait --for condition=available -n ${OPERATOR_NAMESPACE} deploy/${OPERATOR_DEPLOYMENT_NAME}
END
EXCEPT WHILE loop was aborted type=start
Fail msg=Operator deployment did not get ready
END

Verify Pod Logs Contain Error
[Documentation] Checks whether there is a SMCP related error on the Pod Logs
${pod_name}= Get Pod Name ${OPERATOR_NAMESPACE} ${OPERATOR_LABEL_SELECTOR}
${pod_logs}= Oc Get Pod Logs
... name=${pod_name}
... namespace=${OPERATOR_NAMESPACE}
... container=${OPERATOR_POD_CONTAINER_NAME}
${match_list}= Get Regexp Matches ${pod_logs} ${MSSG_REGEX}
${entry_msg}= Remove Duplicates ${match_list}
${length}= Get Length ${entry_msg}
IF ${length} == ${0}
FAIL Pod ${pod_name} logs should contain message ${MSSG_REGEX}.
ELSE
Log message=Pod ${pod_name} logs contain error message '${MSSG_REGEX}' level=INFO
END

Cleanup Olm Install Dir
[Documentation] Clean up olm install repo
${return_code}= Run and Watch Command rm -vRf ${EXECDIR}/${OLM_DIR} timeout=10 min

Check warning

Code scanning / Robocop

Keyword name '{{ keyword_name }}' does not follow case convention Warning test

Keyword name 'Run and Watch Command' does not follow case convention
Should Be Equal As Integers ${return_code} 0 msg=Error while cleaning up olminstall directory
Loading