Skip to content

Commit

Permalink
RHOAIENG-2508 ODS-2600 Validate DSC creates all Serverless CRs (#1259)
Browse files Browse the repository at this point in the history
RHOAIENG-2508
The goal of this Test Case is to automate manual testing on the Platform
scrum team
  • Loading branch information
asanzgom authored Apr 4, 2024
2 parents 9272f08 + 4261ec6 commit cdc6695
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
26 changes: 26 additions & 0 deletions ods_ci/tests/Resources/OCP.resource
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,31 @@ Wait Until CRD Exists
Wait Until Keyword Succeeds 15 times 5s
... Oc Get kind=CustomResourceDefinition name=${crd_fullname}

Resource Should Exist
[Documentation] Check resource existson a namespace
[Arguments] ${resource} ${resource_name} ${namespace}
${rc} ${out}= Run and Return Rc And Output
... oc get ${resource} ${resource_name} -n ${namespace}
Should Be Equal "${rc}" "0" msg=${out}

Resource Status Should Be
[Documentation] Check Resource Status
[Arguments] ${oc_get} ${resource} ${expected_status}
${status}= Run
... ${oc_get}
Log ${status} console=True
Should Be Equal ${status} ${expected_status} msg=${resource} is not in Ready status

Verify Pod Logs Do Not Contain
[Documentation] Checks there are no errors on Pod Logs
[Arguments] ${pod_name} ${pod_namespace} ${regex_pattern} ${container}
${pod_logs}= Oc Get Pod Logs name=${pod_name} namespace=${pod_namespace} container=${container}
${match_list} Get Regexp Matches ${pod_logs} ${regex_pattern}
${entry_msg} Remove Duplicates ${match_list}
${length} Get Length ${entry_msg}
IF ${length} != ${0} FAIL Pod ${pod_name} logs should not contain regexp ${regex_pattern}. Matching log entry: ${entry_msg}
... ELSE Log message=Pod ${pod_name} logs does not contain regexp ${regex_pattern} level=INFO

Is Resource Present
[Documentation] Check If Resource Is Present In Namespace
[Arguments] ${resource} ${resource_name} ${namespace} ${expected_result}
Expand All @@ -225,3 +250,4 @@ Delete Namespace From Openshift
${rc} ${output}= Run And Return Rc And Output oc delete project ${namespace}
Should Be Equal "${rc}" "0" msg=${output}
END

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Verify RHODS operator information
[Tags] ODS-498 ODS-624 Sanity ProductBug Tier1
Open Installed Operators Page
#Select All Projects
Wait Until Keyword Succeeds 10 times 5s Click On Searched Operator Red Hat OpenShift Data Science #robocop: disable
Wait Until Keyword Succeeds 10 times 5s Click On Searched Operator Red Hat OpenShift AI #robocop: disable
${link_elements}= Get WebElements xpath=//*[@class="co-clusterserviceversion-details__field"]//a
#Temporary List to hold the url for the verification
${temp_list} Create List
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
*** Settings ***
Documentation Test Cases to verify Serverless installation
Library Collections
Library SeleniumLibrary
Library OpenShiftLibrary
Resource ../../../../Resources/Page/OCPDashboard/OCPDashboard.resource
Resource ../../../../Resources/OCP.resource
Suite Setup Suite Setup
Suite Teardown Suite Teardown


*** Variables ***
${KNATIVESERVING_NS} knative-serving
${ISTIO_NS} istio-system
${regex_pattern} ERROR
${LABEL_SELECTOR} name=rhods-operator

*** Test Cases ***
Validate DSC creates all Serverless CRs
[Documentation] The purpose of this Test Case is to validate the creation
... of Serverless Custom Resources
... ProductBug: RHOAIENG-4358
[Tags] Operator ODS-2600 ProductBug
Assign Vars According To Product ${PRODUCT}
Resource Should Exist KnativeServing knative-serving ${KNATIVESERVING_NS}
Resource Status Should Be oc get KnativeServing knative-serving -n ${KNATIVESERVING_NS} -o json | jq '.status.conditions[] | select(.type=="Ready") | .status' KnativeServing "True" # robocop: disable
Resource Should Exist Gateway knative-ingress-gateway ${KNATIVESERVING_NS}
Resource Should Exist Gateway knative-local-gateway ${KNATIVESERVING_NS}
Resource Should Exist Service knative-local-gateway ${ISTIO_NS}
Resource Should Exist deployment controller ${KNATIVESERVING_NS}
Wait For Pods Numbers 2 namespace=${KNATIVESERVING_NS}
... label_selector=app.kubernetes.io/component=controller timeout=120
${pod_names}= Get Pod Names ${KNATIVESERVING_NS} app.kubernetes.io/component=controller
Verify Containers Have Zero Restarts ${pod_names} ${KNATIVESERVING_NS}
${podname}= Get Pod Name ${OPERATOR_NAMESPACE} ${LABEL_SELECTOR}
Verify Pod Logs Do Not Contain ${podname} ${OPERATOR_NAMESPACE} ${regex_pattern} rhods-operator
Wait For DSC Conditions Reconciled ${KNATIVESERVING_NS} default-dsc


*** Keywords ***
Suite Setup
[Documentation] Suite Setup
Set Library Search Order SeleniumLibrary
RHOSi Setup

Suite Teardown
[Documentation] Suite Teardown
Close All Browsers
RHOSi Teardown

Assign Vars According To Product
[Documentation] Assign vars related to product
[Arguments] ${PRODUCT}
IF "${PRODUCT}" == "RHODS"
Set Suite Variable ${OPERATOR_APPNAME} Red Hat OpenShift AI
Set Suite Variable ${OPERATOR_NAME} Red Hat OpenShift AI
ELSE IF "${PRODUCT}" == "ODH"
Set Suite Variable ${OPERATOR_APPNAME} Open Data Hub Operator
Set Suite Variable ${OPERATOR_NAME} Open Data Hub Operator
END

Wait For DSC Conditions Reconciled
[Documentation] Checks all DSC conditions to be successfully reconciled
[Arguments] ${namespace} ${dsc_name}
${rc} ${out}= Run And Return Rc And Output
... oc wait --timeout=3m --for jsonpath='{.status.conditions[].reason}'=ReconcileCompleted -n ${namespace} dsc ${dsc_name} # robocop: disable
Should Be Equal As Integers ${rc} ${0}
Log ${out} console=${out}
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ Check And Uninstall Operator In Openshift
IF ${actual_no_of_operator} == ${expected_number_operator}
Uninstall Operator ${operator_name}
ELSE
FAIL Only ${actual_no_of_operator} ${operator_name} is found in Opearatorhub
FAIL Only ${actual_no_of_operator} ${operator_name} is found in Operatorhub

END
END
Expand Down

0 comments on commit cdc6695

Please sign in to comment.