-
Notifications
You must be signed in to change notification settings - Fork 82
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
Changes from 24 commits
b8bbe5d
601222a
da00f98
3f99bc5
3b085ac
2296ab1
6c04140
7b4abdf
8f1f664
4cd24cb
38b1dbf
c8cd1fa
6d36f21
cf1f1c5
7c48f75
4af25ad
4b76708
31205d5
cb4618e
8db0156
28dc83d
cc3559c
df37b0a
54e611f
dec7e54
17c986c
1be5592
1171fce
3474104
ac4fccf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 *** | ||
|
@@ -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. | ||
|
@@ -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 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I can move it to the Suite Teardown There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||
|
||
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
|
||
|
||
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
|
||
|
||
&{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} | ||
|
||
${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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, is it actually removing the dev flags?
Also, isn't this the same action done at https://github.com/red-hat-data-services/ods-ci/pull/1762/files#diff-11c2f02f8419b8b4ee8bf5f117645cfe5da320a349f21813d8da399c47a7ffb3R369
There was a problem hiding this comment.
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