From 0290749c934cdb0aa519eb201f608502d3e3b047 Mon Sep 17 00:00:00 2001 From: Shilpa Chugh Date: Fri, 3 Jan 2025 14:58:46 +0530 Subject: [PATCH] Add keyword to find ROSA_HCP environment (#2143) Add keyword to find test environment --- ods_ci/tests/Resources/OCP.resource | 13 +++++++++++++ .../DistributedWorkloads.resource | 15 +++++++++++++++ .../test-smoke.robot | 7 ++----- .../0602__training/test-smoke.robot | 19 ++++--------------- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/ods_ci/tests/Resources/OCP.resource b/ods_ci/tests/Resources/OCP.resource index f5498b9c8..3fc281995 100644 --- a/ods_ci/tests/Resources/OCP.resource +++ b/ods_ci/tests/Resources/OCP.resource @@ -347,3 +347,16 @@ Is Cluster Type Self-Managed ELSE RETURN ${FALSE} END + +Is Test Enviroment ROSA-HCP + [Documentation] Find the test environment based on output of the infrastructure of the cluster + ... Returns ${TRUE} if test environment is ROSA_HCP + ... Returns ${FALSE} if test environment is not ROSA_HCP + ${rc} ${output}= Run And Return Rc And Output + ... oc get infrastructure cluster -o jsonpath='{.metadata.labels.hypershift\\.openshift\\.io/managed}' + Should Be Equal As Integers ${rc} 0 + IF "${output}" == "true" + RETURN ${TRUE} + ELSE + RETURN ${FALSE} + END diff --git a/ods_ci/tests/Resources/Page/DistributedWorkloads/DistributedWorkloads.resource b/ods_ci/tests/Resources/Page/DistributedWorkloads/DistributedWorkloads.resource index 22693e9d2..a500f95ef 100644 --- a/ods_ci/tests/Resources/Page/DistributedWorkloads/DistributedWorkloads.resource +++ b/ods_ci/tests/Resources/Page/DistributedWorkloads/DistributedWorkloads.resource @@ -2,6 +2,7 @@ Documentation This is a resource file for Distributed Workloads. Library OperatingSystem Library Process +Resource ../../../../tasks/Resources/RHODS_OLM/install/oc_install.robot *** Variables *** @@ -256,3 +257,17 @@ Check missing Go test [Documentation] Check that upstream Go test is not missing [Arguments] ${test_run_output} Should Not Contain ${test_run_output} testing: warning: no tests to run No Go tests were run + +Verify container images + [Documentation] Verify container images + [Arguments] ${pod_name} ${container} ${expected_image} + ${test_env}= Is Test Enviroment ROSA-HCP + # We use Kyverno custom policies to pull unreleased images from quay registry for hypershift clusters + ${registry_name} = Set Variable If ${test_env}==True + ... quay.io + ... registry.redhat.io + Log To Console Verifying ${pod_name}'s container image is referred from ${registry_name} + ${pod} = Find First Pod By Name namespace=${APPLICATIONS_NAMESPACE} pod_regex=${pod_name} + Container Image Url Should Contain ${APPLICATIONS_NAMESPACE} ${pod} ${container} + ... ${registry_name}/rhoai/${expected_image} + Log To Console ${pod_name}'s container image is verified diff --git a/ods_ci/tests/Tests/0600__distributed_workloads/0601__workloads_orchestration/test-smoke.robot b/ods_ci/tests/Tests/0600__distributed_workloads/0601__workloads_orchestration/test-smoke.robot index 6695d05ff..a77a4bba0 100644 --- a/ods_ci/tests/Tests/0600__distributed_workloads/0601__workloads_orchestration/test-smoke.robot +++ b/ods_ci/tests/Tests/0600__distributed_workloads/0601__workloads_orchestration/test-smoke.robot @@ -2,6 +2,7 @@ Documentation Smoke tests for Workloads Orchestration Library Process Resource ../../../../tasks/Resources/RHODS_OLM/install/oc_install.robot +Resource ../../../Resources/Page/DistributedWorkloads/DistributedWorkloads.resource *** Test Cases *** @@ -25,8 +26,4 @@ Kueue smoke test FAIL Can not find kueue-webhook-service service in ${APPLICATIONS_NAMESPACE} END Log To Console kueue-webhook-service service exists - Log To Console Verifying kueue-controller-manager's container image is referred from registry.redhat.io - ${pod} = Find First Pod By Name namespace=${APPLICATIONS_NAMESPACE} pod_regex=kueue-controller-manager- - Container Image Url Should Contain ${APPLICATIONS_NAMESPACE} ${pod} manager - ... registry.redhat.io/rhoai/odh-kueue-controller - Log To Console kueue-controller-manager's container image is verified + Verify container images kueue-controller-manager manager odh-kueue-controller diff --git a/ods_ci/tests/Tests/0600__distributed_workloads/0602__training/test-smoke.robot b/ods_ci/tests/Tests/0600__distributed_workloads/0602__training/test-smoke.robot index 5d4f28989..3b9c6a601 100644 --- a/ods_ci/tests/Tests/0600__distributed_workloads/0602__training/test-smoke.robot +++ b/ods_ci/tests/Tests/0600__distributed_workloads/0602__training/test-smoke.robot @@ -2,6 +2,7 @@ Documentation Smoke tests for Workloads Training Library Process Resource ../../../../tasks/Resources/RHODS_OLM/install/oc_install.robot +Resource ../../../Resources/Page/DistributedWorkloads/DistributedWorkloads.resource Suite Setup Prepare Codeflare E2E Test Suite Suite Teardown Teardown Codeflare E2E Test Suite @@ -28,11 +29,7 @@ Ray smoke test FAIL Can not find kuberay-operator service in ${APPLICATIONS_NAMESPACE} END Log To Console kuberay-operator service exists - Log To Console Verifying kuberay-operator's container image is referred from registry.redhat.io - ${pod} = Find First Pod By Name namespace=${APPLICATIONS_NAMESPACE} pod_regex=kuberay-operator- - Container Image Url Should Contain ${APPLICATIONS_NAMESPACE} ${pod} kuberay-operator - ... registry.redhat.io/rhoai/odh-kuberay-operator-controller - Log To Console kuberay-operator's container image is verified + Verify container images kuberay-operator kuberay-operator odh-kuberay-operator-controller Codeflare smoke test [Documentation] Check that Codeflare deployment and its monitoring service are up and running @@ -54,11 +51,7 @@ Codeflare smoke test FAIL Can not find codeflare-operator-manager-metrics service in ${APPLICATIONS_NAMESPACE} END Log To Console codeflare-operator-manager-metrics service exists - Log To Console Verifying codeflare-operator-manager's container image is referred from registry.redhat.io - ${pod} = Find First Pod By Name namespace=${APPLICATIONS_NAMESPACE} pod_regex=codeflare-operator-manager- - Container Image Url Should Contain ${APPLICATIONS_NAMESPACE} ${pod} manager - ... registry.redhat.io/rhoai/odh-codeflare-operator - Log To Console codeflare-operator-manager's container image is verified + Verify container images codeflare-operator-manager manager odh-codeflare-operator Training operator smoke test [Documentation] Check that Training operator deployment is up and running @@ -72,11 +65,7 @@ Training operator smoke test IF ${result.rc} != 0 FAIL Timeout waiting for deployment/kubeflow-training-operator to be available in ${APPLICATIONS_NAMESPACE} END - Log To Console Verifying kubeflow-training-operator's container image is referred from registry.redhat.io - ${pod} = Find First Pod By Name namespace=${APPLICATIONS_NAMESPACE} pod_regex=kubeflow-training-operator- - Container Image Url Should Contain ${APPLICATIONS_NAMESPACE} ${pod} training-operator - ... registry.redhat.io/rhoai/odh-training-operator - Log To Console kubeflow-training-operator's container image is verified + Verify container images kubeflow-training-operator training-operator odh-training-operator *** Keywords ***