Skip to content

Commit d71a530

Browse files
committed
RHOAIENG-3472: Added test to validate the DSC without dependant operator when kserver is unmanaged
1 parent 5f6dfdb commit d71a530

File tree

4 files changed

+209
-205
lines changed

4 files changed

+209
-205
lines changed

ods_ci/tasks/Resources/RHODS_OLM/uninstall/uninstall.robot

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,22 @@ Uninstall Service Mesh Operator CLI
118118
${return_code} ${output} Run And Return Rc And Output
119119
... oc delete ServiceMeshControlPlane --all --ignore-not-found
120120
Should Be Equal As Integers ${return_code} 0 msg=Error deleting ServiceMeshControlPlane CR
121+
Wait Until Keyword Succeeds 2 min 0 sec
122+
... Check Number Of Resource Instances Equals To ServiceMeshControlPlane istio-system 0
121123
Log To Console message=Deleting ServiceMeshMember CR From Cluster
122124
${return_code} ${output} Run And Return Rc And Output
123125
... oc delete ServiceMeshMember --all --ignore-not-found
124126
Should Be Equal As Integers ${return_code} 0 msg=Error deleting ServiceMeshMember CR
127+
Wait Until Keyword Succeeds 2 min 0 sec
128+
... Check Number Of Resource Instances Equals To ServiceMeshMember istio-system 0
125129
Log To Console message=Deleting ServiceMeshMemberRoll CR From Cluster
126130
${return_code} ${output} Run And Return Rc And Output
127131
... oc delete ServiceMeshMemberRoll --all --ignore-not-found
128132
Should Be Equal As Integers ${return_code} 0 msg=Error deleting ServiceMeshMemberRoll CR
133+
Wait Until Keyword Succeeds 2 min 0 sec
134+
... Check Number Of Resource Instances Equals To ServiceMeshMemberRoll knative-serving 0
135+
Wait Until Keyword Succeeds 2 min 0 sec
136+
... Check Number Of Resource Instances Equals To ServiceMeshMemberRoll redhat-ods-applications-auth-provider 0 # robocop: disable
129137
Log To Console message=Deleting Service Mesh Operator Subscription From Cluster
130138
${return_code} ${csv_name} Run And Return Rc And Output
131139
... oc get subscription servicemeshoperator -n openshift-operators -o json | jq '.status.currentCSV' | tr -d '"'
@@ -143,14 +151,20 @@ Uninstall Serverless Operator CLI
143151
${return_code} ${output} Run And Return Rc And Output
144152
... oc delete KnativeServing --all --ignore-not-found
145153
Should Be Equal As Integers ${return_code} 0 msg=Error deleting KnativeServing CR
154+
Wait Until Keyword Succeeds 2 min 0 sec
155+
... Check Number Of Resource Instances Equals To KnativeServing knative-serving 0
146156
Log To Console message=Deleting KnativeEventing CR From Cluster
147157
${return_code} ${output} Run And Return Rc And Output
148158
... oc delete KnativeEventing --all --ignore-not-found
149159
Should Be Equal As Integers ${return_code} 0 msg=Error deleting KnativeEventing CR
160+
Wait Until Keyword Succeeds 2 min 0 sec
161+
... Check Number Of Resource Instances Equals To KnativeEventing knative-eventing 0
150162
Log To Console message=Deleting KnativeKafka CR From Cluster
151163
${return_code} ${output} Run And Return Rc And Output
152164
... oc delete KnativeKafka --all --ignore-not-found
153165
Should Be Equal As Integers ${return_code} 0 msg=Error deleting KnativeKafka CR
166+
Wait Until Keyword Succeeds 2 min 0 sec
167+
... Check Number Of Resource Instances Equals To KnativeKafka knative-eventing 0
154168
Log To Console message=Deleting Serverless Operator Subscription From Cluster
155169
${return_code} ${csv_name} Run And Return Rc And Output
156170
... oc get subscription serverless-operator -n openshift-serverless -o json | jq '.status.currentCSV' | tr -d '"'
@@ -162,3 +176,11 @@ Uninstall Serverless Operator CLI
162176
${return_code} ${output} Run And Return Rc And Output
163177
... oc delete subscription serverless-operator -n openshift-serverless
164178

179+
Check Number Of Resource Instances Equals To
180+
[Documentation] Keyword to check if the amount of instances of a specific CRD in a given namespace
181+
... equals to a given number
182+
[Arguments] ${resource} ${namespace} ${desired_amount}
183+
${return_code} ${amount} Run And Return Rc And Output
184+
... oc get ${resource} -n ${namespace} -o json | jq -r '.items | length'
185+
Should Be Equal As Integers ${return_code} 0 msg=Error calculating number of ${resource}
186+
Should Be Equal As Integers ${amount} ${desired_amount} msg=Error: ${amount} not equals to ${desired_amount}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
*** Settings ***
2+
Documentation Test Cases to verify DSC/DSCi negative cases when dependant (servicemesh, serverless) operators are not installed
3+
4+
Library Collections
5+
Library OperatingSystem
6+
Resource ../../../../Resources/OCP.resource
7+
Resource ../../../../Resources/ODS.robot
8+
Resource ../../../../Resources/RHOSi.resource
9+
Resource ../../../../Resources/ServiceMesh.resource
10+
Resource ../../../../Resources/Page/OCPDashboard/InstalledOperators/InstalledOperators.robot
11+
Resource ../../../../Resources/Page/OCPDashboard/OperatorHub/InstallODH.robot
12+
Resource ../../../../../tasks/Resources/RHODS_OLM/uninstall/uninstall.robot
13+
Resource ../../../../../tasks/Resources/RHODS_OLM/install/oc_install.robot
14+
Suite Setup Suite Setup
15+
Suite Teardown Suite Teardown
16+
17+
18+
*** Variables ***
19+
${OPERATOR_NS} ${OPERATOR_NAMESPACE}
20+
${DSCI_NAME} default-dsci
21+
${SERVICE_MESH_OPERATOR_NS} openshift-operators
22+
${SERVICE_MESH_CR_NS} istio-system
23+
${SERVICE_MESH_CR_NAME} data-science-smcp
24+
${IS_NOT_PRESENT} 1
25+
26+
27+
*** Test Cases ***
28+
Validate DSC and DSCI Created With Errors When Service Mesh Operator Is Not Installed #robocop:disable
29+
[Documentation] The purpose of this Test Case is to validate that DSC and DSCI are created
30+
... without Service Mesh Operator installer, but with errors
31+
[Tags] Operator Tier3 ODS-2584 RHOAIENG-2514
32+
33+
Remove DSC And DSCI Resources
34+
Uninstall Service Mesh Operator CLI
35+
36+
Log To Console message=Creating DSCInitialization CR via CLI
37+
Apply DSCInitialization CustomResource dsci_name=${DSCI_NAME}
38+
Log To Console message=Checking DSCInitialization conditions
39+
Wait Until Keyword Succeeds 6 min 0 sec
40+
... DSCInitialization Should Fail Because Service Mesh Operator Is Not Installed
41+
42+
Log To Console message=Creating DataScienceCluster CR via CLI
43+
Apply DataScienceCluster CustomResource dsc_name=${DSC_NAME}
44+
Log To Console message=Checking DataScienceCluster conditions
45+
Wait Until Keyword Succeeds 6 min 0 sec
46+
... DataScienceCluster Should Fail Because Service Mesh Operator Is Not Installed
47+
48+
[Teardown] Reinstall Service Mesh Operator And Recreate DSC And DSCI
49+
50+
Validate DSC and DSCI Created With Errors When Service Mesh And Serverless Operators Are Not Installed #robocop:disable
51+
[Documentation] The purpose of this Test Case is to validate that DSC and DSCI are created
52+
... without dependant operators ((servicemesh, serverless) installed, but with errors
53+
[Tags] Operator Tier3 ODS-2527 RHOAIENG-2518
54+
55+
Remove DSC And DSCI Resources
56+
Uninstall Service Mesh Operator CLI
57+
Uninstall Serverless Operator CLI
58+
59+
Log To Console message=Creating DSCInitialization CR via CLI
60+
Apply DSCInitialization CustomResource dsci_name=${DSCI_NAME}
61+
Sleep 45s reason=wait for 45 seconds until DSCI is created and reconciled
62+
63+
Log To Console message=Creating DataScienceCluster CR via CLI
64+
Apply DataScienceCluster CustomResource dsc_name=${DSC_NAME}
65+
Log To Console message=Checking DataScienceCluster conditions
66+
Wait Until Keyword Succeeds 6 min 0 sec
67+
... DataScienceCluster Should Fail Because Service Mesh And Serverless Operators Are Not Installed
68+
69+
[Teardown] Reinstall Service Mesh And Serverless Operators And Recreate DSC And DSCI
70+
71+
Validate DSC and DSCI Created With No Errors When Kserve Serving Is Unmanaged And Service Mesh And Serverless Operators Are Not Installed #robocop:disable
72+
[Documentation] The purpose of this Test Case is to validate that DSC and DSCI are created
73+
... without dependant operators ((servicemesh, serverless) installed and with no errors
74+
... because the Kserve component serving is unmanaged
75+
[Tags] Operator Tier3 RHOAIENG-3472
76+
77+
Remove DSC And DSCI Resources
78+
Uninstall Service Mesh Operator CLI
79+
Uninstall Serverless Operator CLI
80+
81+
Log To Console message=Creating DSCInitialization CR via CLI
82+
Apply DSCInitialization CustomResource dsci_name=${DSCI_NAME}
83+
Set Service Mesh Management State Unmanaged ${OPERATOR_NS}
84+
85+
Wait For DSCInitialization CustomResource To Be Ready timeout=600
86+
87+
Log To Console message=Creating DataScienceCluster CR via CLI
88+
Apply DataScienceCluster CustomResource dsc_name=${DSC_NAME}
89+
90+
Set DataScienceCluster Kserve Serving Management State ${DSC_NAME} Unmanaged
91+
92+
Wait For DataScienceCluster CustomResource To Be Ready timeout=600
93+
94+
[Teardown] Reinstall Service Mesh And Serverless Operators And Recreate DSC And DSCI
95+
96+
97+
*** Keywords ***
98+
Suite Setup
99+
[Documentation] Suite Setup
100+
Set Library Search Order SeleniumLibrary
101+
102+
Suite Teardown
103+
[Documentation] Suite Teardown
104+
Selenium Library.Close All Browsers
105+
RHOSi Teardown
106+
107+
Set DataScienceCluster Kserve Serving Management State
108+
[Documentation] Sets DSC Kserve Serving mgmt state to a specific value
109+
[Arguments] ${dsc_name} ${status}
110+
${result} = Run Process oc patch DataScienceCluster ${dsc_name} --type 'json' -p '[{"op" : "replace" ,"path" : "/spec/components/kserve/serving/managementState" ,"value" : "${status}"}]' #robocop:disable
111+
... shell=true stderr=STDOUT
112+
IF $result.rc != 0
113+
FAIL Can not patch serving.managementState field: ${result.stdout}
114+
END
115+
116+
Reinstall Service Mesh Operator And Recreate DSC And DSCI
117+
[Documentation] Reinstalls Service Mesh operator and waits for the Service Mesh Control plane to be created
118+
Remove DSC And DSCI Resources
119+
Install Service Mesh Operator Via Cli
120+
Apply DSCInitialization CustomResource dsci_name=${DSCI_NAME}
121+
Wait For DSCInitialization CustomResource To Be Ready timeout=180
122+
Apply DataScienceCluster CustomResource dsc_name=${DSC_NAME}
123+
Wait For DataScienceCluster CustomResource To Be Ready timeout=600
124+
Set Service Mesh State To Managed And Wait For CR Ready
125+
... ${SERVICE_MESH_CR_NAME} ${SERVICE_MESH_CR_NS} ${SERVICE_MESH_OPERATOR_NS}
126+
127+
Reinstall Service Mesh And Serverless Operators And Recreate DSC And DSCI
128+
[Documentation] Reinstalls Dependant (service mesh, serverless) operators and waits for the Service Mesh Control plane to be created
129+
Remove DSC And DSCI Resources
130+
Install Serverless Operator Via Cli
131+
Install Service Mesh Operator Via Cli
132+
Apply DSCInitialization CustomResource dsci_name=${DSCI_NAME}
133+
Wait For DSCInitialization CustomResource To Be Ready timeout=180
134+
Apply DataScienceCluster CustomResource dsc_name=${DSC_NAME}
135+
Wait For DataScienceCluster CustomResource To Be Ready timeout=600
136+
Set Service Mesh State To Managed And Wait For CR Ready
137+
... ${SERVICE_MESH_CR_NAME} ${SERVICE_MESH_CR_NS} ${SERVICE_MESH_OPERATOR_NS}
138+
139+
Remove DSC And DSCI Resources
140+
[Documentation] Removed DSC and DSCI CRs resources from the cluster
141+
Log To Console message=Deleting DataScienceCluster CR From Cluster
142+
${return_code} ${output}= Run And Return Rc And Output
143+
... oc delete DataScienceCluster --all --ignore-not-found
144+
Should Be Equal As Integers ${return_code} 0 msg=Error deleting DataScienceCluster CR
145+
146+
Wait Until Keyword Succeeds 3 min 0 sec
147+
... Is Resource Present DataScienceCluster ${DSC_NAME}
148+
... ${OPERATOR_NS} ${IS_NOT_PRESENT}
149+
150+
Log To Console message=Deleting DSCInitialization CR From Cluster
151+
${return_code} ${output}= Run And Return Rc And Output
152+
... oc delete DSCInitialization --all --ignore-not-found
153+
Should Be Equal As Integers ${return_code} 0 msg=Error deleting DSCInitialization CR
154+
155+
Wait Until Keyword Succeeds 3 min 0 sec
156+
... Is Resource Present DSCInitialization ${DSCI_NAME}
157+
... ${OPERATOR_NS} ${IS_NOT_PRESENT}
158+
159+
DataScienceCluster Should Fail Because Service Mesh And Serverless Operators Are Not Installed
160+
[Documentation] Keyword to check the DSC conditions when dependant (servicemesh, serverless) operators are not installed.
161+
... Two conditions, one per operator, should appear saying this operator is needed to enable kserve component.
162+
${return_code} ${output}= Run And Return Rc And Output
163+
... oc get DataScienceCluster ${DSC_NAME} -n ${OPERATOR_NS} -o json | jq -r '.status.conditions | map(.message) | join(",")' #robocop:disable
164+
Should Be Equal As Integers ${return_code} 0 msg=Error retrieved DSC conditions
165+
Should Contain ${output} operator servicemeshoperator not found. Please install the operator before enabling kserve component #robocop:disable
166+
Should Contain ${output} operator serverless-operator not found. Please install the operator before enabling kserve component #robocop:disable
167+
168+
DSCInitialization Should Fail Because Service Mesh Operator Is Not Installed
169+
[Documentation] Keyword to check the DSCI conditions when service mesh operator is not installed.
170+
... One condition should appear saying this operator is needed to enable kserve component.
171+
${return_code} ${output}= Run And Return Rc And Output
172+
... oc get DSCInitialization ${DSCI_NAME} -n ${OPERATOR_NS} -o json | jq -r '.status.conditions | map(.message) | join(",")' #robocop:disable
173+
Should Be Equal As Integers ${return_code} 0 msg=Error retrieved DSCI conditions
174+
Should Contain ${output} failed to find the pre-requisite Service Mesh Operator subscription, please ensure Service Mesh Operator is installed. failed to find the pre-requisite operator subscription \"servicemeshoperator\", please ensure operator is installed. missing operator \"servicemeshoperator\" #robocop:disable
175+
176+
DataScienceCluster Should Fail Because Service Mesh Operator Is Not Installed
177+
[Documentation] Keyword to check the DSC conditions when service mesh operator is not installed.
178+
... One condition should appear saying this operator is needed to enable kserve component.
179+
${return_code} ${output}= Run And Return Rc And Output
180+
... oc get DataScienceCluster ${DSC_NAME} -n ${OPERATOR_NS} -o json | jq -r '.status.conditions | map(.message) | join(",")' #robocop:disable
181+
Should Be Equal As Integers ${return_code} 0 msg=Error retrieved DSC conditions
182+
Should Contain ${output} Component reconciliation failed: 1 error occurred:\n\t* operator servicemeshoperator not found. Please install the operator before enabling kserve component #robocop:disable
183+
184+
${rc} ${logs}= Run And Return Rc And Output
185+
... oc logs -l name=rhods-operator -c rhods-operator -n ${OPERATOR_NS} --ignore-errors
186+
187+
Should Contain ${logs} failed to find the pre-requisite Service Mesh Operator subscription, please ensure Service Mesh Operator is installed. #robocop:disable

0 commit comments

Comments
 (0)