From e3161b90bb47aa8893b04ad4cc727d18d50e777e Mon Sep 17 00:00:00 2001 From: asanzgom Date: Fri, 25 Oct 2024 10:06:02 +0200 Subject: [PATCH 1/6] Test Case check for correct component images --- .../0114__component_images.robot | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot diff --git a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot new file mode 100644 index 000000000..a8921b3bf --- /dev/null +++ b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot @@ -0,0 +1,106 @@ +*** Settings *** +Documentation Test Suite to check for components + +Resource ../../../../../../tasks/Resources/RHODS_OLM/install/oc_install.robot + +Suite Setup Suite Setup +Suite Teardown Suite Teardown + + +*** Variables *** +@{COMPONENTS} = +... codeflare +... modelregistry +... trustyai +... ray +... kueue +... workbenches +... dashboard +... modelmeshserving +... datasciencepipelines +... trainingoperator + + +*** Test Cases *** +Check For Correct Component Images + [Documentation] The purpose is to enforce the check of correct component images on their deployments. + [Tags] Operator RHOAIENG-12576 + FOR ${cmp} IN @{COMPONENTS} + ${rc} ${managementState}= Run And Return Rc And Output + ... oc get DataScienceCluster default-dsc -o jsonpath="{.spec.components['${cmp}'].managementState}" + IF "${managementState}" == "Managed" + IF "${cmp}" == "codeflare" + Check Image On Csv And Deployment + ... odh_codeflare_operator_image + ... codeflare-operator-manager + ELSE IF "${cmp}" == "modelregistry" + Check Image On Csv And Deployment + ... odh_mlmd_grpc_server_image + ... model-registry-operator-controller-manager + Check Image On Csv And Deployment + ... odh_model_registry_image + ... model-registry-operator-controller-manager + ELSE IF "${cmp}" == "trustyai" + Check Image On Csv And Deployment + ... odh_trustyai_service_operator_image + ... trustyai-service-operator-controller-manager + ELSE IF "${cmp}" == "ray" + Check Image On Csv And Deployment + ... odh_kuberay_operator_controller_image + ... kuberay-operator + ELSE IF "${cmp}" == "kueue" + Check Image On Csv And Deployment + ... odh_kueue_controller_image + ... kueue-controller-manager + ELSE IF "${cmp}" == "workbenches" + Check Image On Csv And Deployment + ... odh_notebook_controller_image + ... odh-notebook-controller-manager + Check Image On Csv And Deployment + ... odh_kf_notebook_controller_image + ... notebook-controller-deployment + ELSE IF "${cmp}" == "dashboard" + Check Image On Csv And Deployment odh_dashboard_image ${DASHBOARD_DEPLOYMENT_NAME} + ELSE IF "${cmp}" == "modelmeshserving" + Check Image On Csv And Deployment + ... odh_modelmesh_controller_image + ... modelmesh-controller + ELSE IF "${cmp}" == "datasciencepipelines" + Check Image On Csv And Deployment + ... odh_data_science_pipelines_operator_controller_image + ... data-science-pipelines-operator-controller-manager + ELSE IF "${cmp}" == "trainingoperator" + Check Image On Csv And Deployment + ... odh_training_operator_image + ... kubeflow-training-operator + END + END + END + + +*** Keywords *** +Suite Setup + [Documentation] Suite Setup + RHOSi Setup + +Suite Teardown + [Documentation] Suite Teardown + RHOSi Teardown + +Check Image On Csv And Deployment + [Documentation] Check Image On Csv And Deployment + [Arguments] ${image} ${deployment_name} + + ${jsonpath}= Set Variable + ... '{.items[?(@.kind=="ClusterServiceVersion")].spec.relatedImages[?(@.name=="${image}")].image}' + ${rc} ${csv_image}= Run And Return Rc And Output + ... oc get ClusterServiceVersion -l ${OPERATOR_SUBSCRIPTION_LABEL} -o jsonpath=${jsonpath} + Should Be Equal "${rc}" "0" msg=${csv_image} + Should Not Be Empty ${csv_image} + Log To Console IMAGE ON CSV IS ${csv_image} + + # Check for regex to see whether it is pointing mistream or downstream + ${rc} ${out}= Run And Return Rc And Output + ... oc get Deployment ${deployment_name} -n ${APPLICATIONS_NAMESPACE} -o jsonpath='{.spec.template.spec.containers[?(@.images=="${csv_image}")]}' + Should Be Equal "${rc}" "0" msg=${csv_image} not found on ${deployment_name} deployment + Log To Console SUCCESS: Both CSV and Deployment ${image} images match From 031cd841d1f6dce49d0fd169df3b3b1b577936d5 Mon Sep 17 00:00:00 2001 From: asanzgom Date: Mon, 28 Oct 2024 11:23:31 +0100 Subject: [PATCH 2/6] changed json path from var to sentence --- .../0104__rhods_operator/0114__component_images.robot | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot index a8921b3bf..1fe3700e1 100644 --- a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot +++ b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot @@ -91,10 +91,8 @@ Check Image On Csv And Deployment [Documentation] Check Image On Csv And Deployment [Arguments] ${image} ${deployment_name} - ${jsonpath}= Set Variable - ... '{.items[?(@.kind=="ClusterServiceVersion")].spec.relatedImages[?(@.name=="${image}")].image}' ${rc} ${csv_image}= Run And Return Rc And Output - ... oc get ClusterServiceVersion -l ${OPERATOR_SUBSCRIPTION_LABEL} -o jsonpath=${jsonpath} + ... oc get ClusterServiceVersion -l ${OPERATOR_SUBSCRIPTION_LABEL} -o jsonpath='{.items[?(@.kind=="ClusterServiceVersion")].spec.relatedImages[?(@.name=="${image}")].image}' Should Be Equal "${rc}" "0" msg=${csv_image} Should Not Be Empty ${csv_image} Log To Console IMAGE ON CSV IS ${csv_image} From dd70dcb9b21eab7d08e30f976eaeb395875bb0c2 Mon Sep 17 00:00:00 2001 From: asanzgom Date: Mon, 28 Oct 2024 12:31:30 +0100 Subject: [PATCH 3/6] added namespace flag to oc command --- .../0104__rhods_operator/0114__component_images.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot index 1fe3700e1..97cc51513 100644 --- a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot +++ b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot @@ -92,7 +92,7 @@ Check Image On Csv And Deployment [Arguments] ${image} ${deployment_name} ${rc} ${csv_image}= Run And Return Rc And Output - ... oc get ClusterServiceVersion -l ${OPERATOR_SUBSCRIPTION_LABEL} -o jsonpath='{.items[?(@.kind=="ClusterServiceVersion")].spec.relatedImages[?(@.name=="${image}")].image}' + ... oc get ClusterServiceVersion -l ${OPERATOR_SUBSCRIPTION_LABEL} -n ${OPERATOR_NAMESPACE} -o jsonpath='{.items[?(@.kind=="ClusterServiceVersion")].spec.relatedImages[?(@.name=="${image}")].image}' Should Be Equal "${rc}" "0" msg=${csv_image} Should Not Be Empty ${csv_image} Log To Console IMAGE ON CSV IS ${csv_image} From b8f39534e5decdf07ebd4fc176459eed95024ca2 Mon Sep 17 00:00:00 2001 From: asanzgom Date: Mon, 28 Oct 2024 13:08:58 +0100 Subject: [PATCH 4/6] Added Smoke tag to Test Case --- .../0104__rhods_operator/0114__component_images.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot index 97cc51513..40ce1ad92 100644 --- a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot +++ b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot @@ -24,7 +24,7 @@ Suite Teardown Suite Teardown *** Test Cases *** Check For Correct Component Images [Documentation] The purpose is to enforce the check of correct component images on their deployments. - [Tags] Operator RHOAIENG-12576 + [Tags] Operator RHOAIENG-12576 Smoke FOR ${cmp} IN @{COMPONENTS} ${rc} ${managementState}= Run And Return Rc And Output ... oc get DataScienceCluster default-dsc -o jsonpath="{.spec.components['${cmp}'].managementState}" From 776d880aea4a63a5b3b3da1a9d394953d64d3229 Mon Sep 17 00:00:00 2001 From: asanzgom Date: Mon, 28 Oct 2024 14:42:55 +0100 Subject: [PATCH 5/6] Removed leftover comment --- .../0104__rhods_operator/0114__component_images.robot | 1 - 1 file changed, 1 deletion(-) diff --git a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot index 40ce1ad92..54e575fff 100644 --- a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot +++ b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot @@ -97,7 +97,6 @@ Check Image On Csv And Deployment Should Not Be Empty ${csv_image} Log To Console IMAGE ON CSV IS ${csv_image} - # Check for regex to see whether it is pointing mistream or downstream ${rc} ${out}= Run And Return Rc And Output ... oc get Deployment ${deployment_name} -n ${APPLICATIONS_NAMESPACE} -o jsonpath='{.spec.template.spec.containers[?(@.images=="${csv_image}")]}' Should Be Equal "${rc}" "0" msg=${csv_image} not found on ${deployment_name} deployment From c8c9cb7a1081e8ee0b7127b58651d092d28d6562 Mon Sep 17 00:00:00 2001 From: asanzgom Date: Mon, 28 Oct 2024 16:26:00 +0100 Subject: [PATCH 6/6] Changed IF ELSE structure to template --- .../0114__component_images.robot | 104 +++++------------- 1 file changed, 29 insertions(+), 75 deletions(-) diff --git a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot index 54e575fff..95ab8b8cd 100644 --- a/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot +++ b/ods_ci/tests/Tests/0100__platform/0101__deploy/0104__operators/0104__rhods_operator/0114__component_images.robot @@ -7,75 +7,23 @@ Suite Setup Suite Setup Suite Teardown Suite Teardown -*** Variables *** -@{COMPONENTS} = -... codeflare -... modelregistry -... trustyai -... ray -... kueue -... workbenches -... dashboard -... modelmeshserving -... datasciencepipelines -... trainingoperator - - *** Test Cases *** Check For Correct Component Images [Documentation] The purpose is to enforce the check of correct component images on their deployments. [Tags] Operator RHOAIENG-12576 Smoke - FOR ${cmp} IN @{COMPONENTS} - ${rc} ${managementState}= Run And Return Rc And Output - ... oc get DataScienceCluster default-dsc -o jsonpath="{.spec.components['${cmp}'].managementState}" - IF "${managementState}" == "Managed" - IF "${cmp}" == "codeflare" - Check Image On Csv And Deployment - ... odh_codeflare_operator_image - ... codeflare-operator-manager - ELSE IF "${cmp}" == "modelregistry" - Check Image On Csv And Deployment - ... odh_mlmd_grpc_server_image - ... model-registry-operator-controller-manager - Check Image On Csv And Deployment - ... odh_model_registry_image - ... model-registry-operator-controller-manager - ELSE IF "${cmp}" == "trustyai" - Check Image On Csv And Deployment - ... odh_trustyai_service_operator_image - ... trustyai-service-operator-controller-manager - ELSE IF "${cmp}" == "ray" - Check Image On Csv And Deployment - ... odh_kuberay_operator_controller_image - ... kuberay-operator - ELSE IF "${cmp}" == "kueue" - Check Image On Csv And Deployment - ... odh_kueue_controller_image - ... kueue-controller-manager - ELSE IF "${cmp}" == "workbenches" - Check Image On Csv And Deployment - ... odh_notebook_controller_image - ... odh-notebook-controller-manager - Check Image On Csv And Deployment - ... odh_kf_notebook_controller_image - ... notebook-controller-deployment - ELSE IF "${cmp}" == "dashboard" - Check Image On Csv And Deployment odh_dashboard_image ${DASHBOARD_DEPLOYMENT_NAME} - ELSE IF "${cmp}" == "modelmeshserving" - Check Image On Csv And Deployment - ... odh_modelmesh_controller_image - ... modelmesh-controller - ELSE IF "${cmp}" == "datasciencepipelines" - Check Image On Csv And Deployment - ... odh_data_science_pipelines_operator_controller_image - ... data-science-pipelines-operator-controller-manager - ELSE IF "${cmp}" == "trainingoperator" - Check Image On Csv And Deployment - ... odh_training_operator_image - ... kubeflow-training-operator - END - END - END + [Template] Check Image On Csv And Deployment + codeflare codeflare-operator-manager odh_codeflare_operator_image + modelregistry model-registry-operator-controller-manager odh_mlmd_grpc_server_image + modelregistry model-registry-operator-controller-manager odh_model_registry_image + trustyai trustyai-service-operator-controller-manager odh_trustyai_service_operator_image + ray kuberay-operator odh_kuberay_operator_controller_image + kueue kueue-controller-manager odh_kueue_controller_image + workbenches odh-notebook-controller-manager odh_notebook_controller_image + workbenches notebook-controller-deployment odh_kf_notebook_controller_image + dashboard ${DASHBOARD_DEPLOYMENT_NAME} odh_dashboard_image + modelmeshserving modelmesh-controller odh_modelmesh_controller_image + datasciencepipelines data-science-pipelines-operator-controller-manager odh_data_science_pipelines_operator_controller_image + trainingoperator kubeflow-training-operator odh_training_operator_image *** Keywords *** @@ -89,15 +37,21 @@ Suite Teardown Check Image On Csv And Deployment [Documentation] Check Image On Csv And Deployment - [Arguments] ${image} ${deployment_name} + [Arguments] ${component} ${deployment_name} ${image} - ${rc} ${csv_image}= Run And Return Rc And Output - ... oc get ClusterServiceVersion -l ${OPERATOR_SUBSCRIPTION_LABEL} -n ${OPERATOR_NAMESPACE} -o jsonpath='{.items[?(@.kind=="ClusterServiceVersion")].spec.relatedImages[?(@.name=="${image}")].image}' - Should Be Equal "${rc}" "0" msg=${csv_image} - Should Not Be Empty ${csv_image} - Log To Console IMAGE ON CSV IS ${csv_image} + ${rc} ${managementState}= Run And Return Rc And Output + ... oc get DataScienceCluster default-dsc -o jsonpath="{.spec.components['${component}'].managementState}" + IF "${managementState}" == "Managed" - ${rc} ${out}= Run And Return Rc And Output - ... oc get Deployment ${deployment_name} -n ${APPLICATIONS_NAMESPACE} -o jsonpath='{.spec.template.spec.containers[?(@.images=="${csv_image}")]}' - Should Be Equal "${rc}" "0" msg=${csv_image} not found on ${deployment_name} deployment - Log To Console SUCCESS: Both CSV and Deployment ${image} images match + ${rc} ${csv_image}= Run And Return Rc And Output + ... oc get ClusterServiceVersion -l ${OPERATOR_SUBSCRIPTION_LABEL} -n ${OPERATOR_NAMESPACE} -o jsonpath='{.items[?(@.kind=="ClusterServiceVersion")].spec.relatedImages[?(@.name=="${image}")].image}' + Should Be Equal "${rc}" "0" msg=${csv_image} + Should Not Be Empty ${csv_image} + Log To Console IMAGE ON CSV IS ${csv_image} + + ${rc} ${out}= Run And Return Rc And Output + ... oc get Deployment ${deployment_name} -n ${APPLICATIONS_NAMESPACE} -o jsonpath='{.spec.template.spec.containers[?(@.images=="${csv_image}")]}' + Should Be Equal "${rc}" "0" msg=${csv_image} not found on ${deployment_name} deployment + Log To Console SUCCESS: Both CSV and Deployment ${image} images match + + END