Skip to content

Commit

Permalink
Merge branch 'master' into f/tgis_ui
Browse files Browse the repository at this point in the history
  • Loading branch information
bdattoma authored Jan 25, 2024
2 parents 2fb4b51 + e207ead commit a7c1e01
Show file tree
Hide file tree
Showing 29 changed files with 368 additions and 74 deletions.
34 changes: 32 additions & 2 deletions ods_ci/tests/Resources/Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Resource RHOSi.resource

*** Variables ***
@{DEFAULT_CHARS_TO_ESCAPE}= : / .
${MONITORING_CONFIG_FILEPATH}= ods_ci/tests/Resources/Files/uwm_cm_conf.yaml
${UWM_CONFIG_FILEPATH}= ods_ci/tests/Resources/Files/uwm_cm_enable.yaml


*** Keywords ***
Expand Down Expand Up @@ -93,6 +95,21 @@ CSS Property Value Should Be
Run Keyword And Continue On Failure Should Be Equal ${actual_value} ${exp_value}
END

Page Should Contain A String In List
[Documentation] Verifies that page contains at least one of the strings in text_list
[Arguments] ${text_list}
FOR ${text} IN @{text_list}
${text_found}= Run Keyword And Return Status Page Should Contain ${text}
IF ${text_found} RETURN
END
Fail Current page doesn't contain any of the strings in: @{text_list}

Wait Until Page Contains A String In List
[Documentation] Waits until page contains at least one of the strings in text_list
[Arguments] ${text_list} ${retry}=12x ${retry_interval}=5s
Wait Until Keyword Succeeds ${retry} ${retry_interval}
... Page Should Contain A String In List ${text_list}

#robocop: disable: line-too-long
Get RHODS Version
[Documentation] Return RHODS/ODH operator version number.
Expand Down Expand Up @@ -363,7 +380,7 @@ Run And Watch Command
${is_test}= Run keyword And Return Status Variable Should Exist ${TEST NAME}
IF ${is_test} == ${FALSE}
${incremental}= Generate Random String 5 [NUMBERS]
${TEST NAME}= Set Variable testlogs-${incremental}
${TEST NAME}= Set Variable testlogs-${incremental}
END
${process_log} = Set Variable ${OUTPUT DIR}/${TEST NAME}.log
${temp_log} = Set Variable ${TEMPDIR}/${TEST NAME}.log
Expand Down Expand Up @@ -412,4 +429,17 @@ Skip If Component Is Not Enabled
[Documentation] Skips test if ${component_name} is not enabled in DataScienceCluster
[Arguments] ${component_name}
${enabled}= Is Component Enabled ${component_name}
Skip If "${enabled}" == "false"
Skip If "${enabled}" == "false"

Enable User Workload Monitoring
[Documentation] Enable User Workload Monitoring for the cluster for user-defined-projects
${return_code} ${output} Run And Return Rc And Output oc apply -f ${MONITORING_CONFIG_FILEPATH}
Log To Console ${output}
Should Be Equal As Integers ${return_code} 0 msg=Error while applying the provided file

Configure User Workload Monitoring
[Documentation] Configure the retention period in User Workload Monitoring for the cluster.
... This period can be configured for the component as and when needed.
${return_code} ${output} Run And Return Rc And Output oc apply -f ${UWM_CONFIG_FILEPATH}
Log To Console ${output}
Should Be Equal As Integers ${return_code} 0 msg=Error while applying the provided file

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions ods_ci/tests/Resources/Files/TrustyAI/trustyai_cr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: trustyai.opendatahub.io/v1alpha1
kind: TrustyAIService
metadata:
name: trustyai-service
spec:
storage:
format: "PVC"
folder: "/inputs"
size: "1Gi"
data:
filename: "data.csv"
format: "CSV"
metrics:
schedule: "5s"
10 changes: 0 additions & 10 deletions ods_ci/tests/Resources/Files/llm/uwm_cm_conf.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion ods_ci/tests/Resources/Files/openvino-example-input.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"inputs": [{"name": "Func/StatefulPartitionedCall/input/_0:0", "shape": [1,30], "datatype": "FP32", "data": [[-0.81527562, -0.62780094, 1.18457726, -0.56138278, 1.97545981, -1.38669424, -0.03372776, -1.08378356, -0.46514641, -1.07813139, -2.98031409, 2.29087639, -2.82230106, 0.76695155, -5.65368683, 0.04526619, -4.77118557, -5.04520325, -3.02616084, 1.14274513, 0.35082495, 1.64467922, 0.38254332, 0.03085198, 0.83964697, -0.38594229, -0.51760032, 1.39294962, 0.22815041, 0.3301235]]}]}
{"inputs": [{"name": "Func/StatefulPartitionedCall/input/_0:0", "shape": [1,30], "datatype": "FP32", "data": [[-0.81527562, -0.62780094, 1.18457726, -0.56138278, 1.97545981, -1.38669424, -0.03372776, -1.08378356, -0.46514641, -1.07813139, -2.98031409, 2.29087639, -2.82230106, 0.76695155, -5.65368683, 0.04526619, -4.77118557, -5.04520325, -3.02616084, 1.14274513, 0.35082495, 1.64467922, 0.38254332, 0.03085198, 0.83964697, -0.38594229, -0.51760032, 1.39294962, 0.22815041, 0.3301235]]}]}
15 changes: 15 additions & 0 deletions ods_ci/tests/Resources/Files/uwm_cm_conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: user-workload-monitoring-config
namespace: openshift-user-workload-monitoring
data:
config.yaml: |
prometheus:
logLevel: debug
retention: 15d #Change as needed
volumeClaimTemplate:
spec:
resources:
requests:
storage: 40Gi
20 changes: 14 additions & 6 deletions ods_ci/tests/Resources/Page/LoginPage.robot
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,24 @@ Select Login Authentication Type
Click Element link:${auth_type}

Login To Openshift
[Arguments] ${ocp_user_name} ${ocp_user_pw} ${ocp_user_auth_type}
# Check if we are in the Openshift auth page
[Documentation] Generic keyword to log in to OpenShift Console or other web applications using oauth-proxy.
... It detects when login is not required because of a previous authentication and the page is
... being automatically redirected to the destination app. Note: ${expected_text_list} should contain a
... expected string in the destination app.
[Arguments] ${ocp_user_name} ${ocp_user_pw} ${ocp_user_auth_type}

# Wait until page is the Login page or the destination app
${expected_text_list} = Create List Log in with Administrator Developer Data Science Projects
Wait Until Page Contains A String In List ${expected_text_list}

# Return if page is not the Login page (no login required)
${should_login} = Is Current Domain Equal To https://oauth-openshift
IF ${should_login}==False
RETURN
END
IF not ${should_login} RETURN

# If here we need to login
Wait Until Element is Visible xpath://div[@class="pf-c-login"] timeout=10s
${select_auth_type} = Does Login Require Authentication Type
IF ${select_auth_type} Select Login Authentication Type ${ocp_user_auth_type}
IF ${select_auth_type} Select Login Authentication Type ${ocp_user_auth_type}
Wait Until Page Contains Log in to your account
Input Text id=inputUsername ${ocp_user_name}
Input Text id=inputPassword ${ocp_user_pw}
Expand Down
36 changes: 33 additions & 3 deletions ods_ci/tests/Resources/Page/OCPDashboard/Monitoring/Metrics.robot
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ Library SeleniumLibrary


*** Variables ***
${METRICS_QUERY_TEXTAREA} xpath=//*[@aria-label='Expression (press Shift+Enter for newlines)']
${METRICS_QUERY_RESULTS_TABLE_ROW1_VALUE_ELEMENT} xpath=//td[@data-label='Value']
${METRICS_QUERY_TEXTAREA} xpath=//*[@aria-label='Expression (press Shift+Enter for newlines)']
${METRICS_QUERY_RESULTS_TABLE_ROW1_VALUE_ELEMENT} xpath=//td[@data-label='Value']
${METRICS_QUERY_RESULTS_TABLE_ROW1_VALUE_ELEMENT_XP} //td[@data-label='Value']


*** Keywords ***
Expand All @@ -14,7 +15,7 @@ Verify Page Loaded

Verify Query Results Contain Data
Wait Until Page Contains Element ${METRICS_QUERY_RESULTS_TABLE_ROW1_VALUE_ELEMENT} timeout=20 error="Query results don't contain data"
${metrics_query_result_row1_value} = Get Text ${METRICS_QUERY_RESULTS_TABLE_ROW1_VALUE_ELEMENT}
${metrics_query_result_row1_value} = Get Text xpath:${METRICS_QUERY_RESULTS_TABLE_ROW1_VALUE_ELEMENT_XP}
Should Be True '${metrics_query_result_row1_value}' != '' "Query results don't contain data"
Should Be True '${metrics_query_result_row1_value}' != 'None' "Query results don't contain data"

Expand Down Expand Up @@ -54,3 +55,32 @@ Get Query Results
END
END
RETURN ${metrics_query_result_row1_value}

Run OpenShift Metrics Query
[Documentation] Runs a query in the Monitoring section of Open Shift
... Note: in order to run this keyword OCP_ADMIN_USER.USERNAME needs to
... belong to a group with "view" role in OpenShift
... Example command to assign the role: oc adm policy add-cluster-role-to-group view rhods-admins
[Arguments] ${query} ${username} ${password} ${auth_type} ${retry_attempts}=10 ${return_zero_if_result_empty}=False
Open OCP Console
LoginPage.Login To Openshift ocp_user_name=${username} ocp_user_pw=${password} ocp_user_auth_type=${auth_type}
OCPMenu.Switch To Administrator Perspective

# In OCP 4.9 metrics are under the Observe menu (it was called Monitoring in 4.8)
${menu_observe_exists} = Run Keyword and Return Status Menu.Page Should Contain Menu Observe
IF ${menu_observe_exists}
Menu.Navigate To Page Observe Metrics
ELSE
${menu_monitoring_exists} = Run Keyword and Return Status Menu.Page Should Contain Menu Monitoring
IF ${menu_monitoring_exists}
Menu.Navigate To Page Monitoring Metrics
ELSE
Fail msg=${username} can't see the Observe/Monitoring section in OpenShift Console, please make sure it belongs to a group with "view" role
END
END

Metrics.Verify Page Loaded
Metrics.Run Query ${query} ${retry_attempts}
${result} = Metrics.Get Query Results return_zero_if_result_empty=${return_zero_if_result_empty}
RETURN ${result}

2 changes: 2 additions & 0 deletions ods_ci/tests/Resources/Page/OCPDashboard/OCPMenu.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ${LOADING_INDICATOR_ELEMENT} xpath=//*[@data-test="loading-indicator"]

*** Keywords ***
Wait Until OpenShift Console Is Loaded
${expected_text_list}= Create List Administrator Developer
Wait Until Page Contains A String In List ${expected_text_list}
Wait Until Element Is Enabled ${APP_LAUNCHER_ELEMENT} timeout=60

Switch To Administrator Perspective
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ Authorize rhods-dashboard service account

Login To RHODS Dashboard
[Arguments] ${ocp_user_name} ${ocp_user_pw} ${ocp_user_auth_type}
#Wait Until Page Contains Log in with

# Wait until we are in the OpenShift auth page or already in Dashboard
${expected_text_list}= Create List Log in with Data Science Projects
Wait Until Page Contains A String In List ${expected_text_list}

${oauth_prompt_visible} = Is OpenShift OAuth Login Prompt Visible
IF ${oauth_prompt_visible} Click Button Log in with OpenShift
${login-required} = Is OpenShift Login Visible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Select Model Server
... Page Should Contain Element xpath://span[.="Model servers"]/../../..//button[@aria-label="Options menu"]
IF ${selectable}==True
Open Model servers Options Menu # robocop:disable
Click Element xpath=//li/button[.="${model_server}"]
Click Element xpath://li/button[.="${model_server}"]
END

Select Framework
Expand Down Expand Up @@ -205,6 +205,13 @@ Get Model Route via UI
${url}= SeleniumLibrary.Get Element Attribute ${route_xpath} value
RETURN ${url}

Get Model Route Via CLI
[Documentation] Grabs the serving route (URL) of an already deployed model from CLI.
[Arguments] ${model_name} ${project_name}
${rc} ${out}= Run And Return Rc And Output oc get route ${model_name} -n ${project_name} --template={{.spec.host}}{{.spec.path}}
Should Be Equal As Integers ${rc} 0 msg=Error getting model route
RETURN https://${out}/infer

Open ${section} Options Menu
[Documentation] Opens the "Options menu" dropdown for different sections
... Valid sections are: "Name", "Model framework (name - version)", "Project"
Expand Down Expand Up @@ -241,7 +248,7 @@ Get Model Inference
... ${project_title}=${NONE}
${self_managed} = Is RHODS Self-Managed
${url}= Get Model Route via UI ${model_name}
${curl_cmd}= Set Variable curl -s ${url} -d ${inference_input}
${curl_cmd}= Set Variable curl -s ${url} -d @${inference_input}
IF ${token_auth}
IF "${project_title}" == "${NONE}"
${project_title}= Get Model Project ${model_name}
Expand Down Expand Up @@ -488,4 +495,4 @@ Set Up Project
Oc Apply kind=ConfigMap src=${UWM_CONFIG_FILEPATH}
ELSE
Log message=Skipping UserWorkloadMonitoring enablement.
END
END
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
*** Settings ***
Documentation Post install test cases that verify OCP KServe resources and objects
Library OpenShiftLibrary


*** Variables ***
${TRUSTYAI_NS}= ${APPLICATIONS_NAMESPACE}


*** Test Cases ***
Verify TrustyAI Operator Installation
[Documentation] Verifies that the TrustyAI operator has been
... deployed in the ${APPLICATIONS_NAMESPACE} namespace in ODS
[Tags] Smoke
... Tier1 ODS-2481
Run Keyword And Continue On Failure Wait Until Keyword Succeeds 1 min 10 sec Verify TrustyAI Deployment
Wait Until Keyword Succeeds 10 times 5s Verify TrustyAI ReplicaSets Info
Wait Until Keyword Succeeds 10 times 5s Verify TrustyAI Container Names


*** Keywords ***
Verify trustyai-service-operator-controller-manager Deployment
[Documentation] Verifies the deployment of the trustyai operator in the namespace
Wait For Pods To Be Ready label_selector=app.kubernetes.io/created-by=trustyai-service-operator
... namespace=${APPLICATIONS_NAMESPACE} exp_replicas=1

Verify TrustyAI ReplicaSets Info
[Documentation] Fetches and verifies information from TrustyAI replicasets
@{trustyai_replicasets_info} = Oc Get kind=ReplicaSet api_version=v1 namespace=${TRUSTYAI_NS}
... label_selector=app.kubernetes.io/part-of=trustyai-service-operator
OpenShift Resource Field Value Should Be Equal As Strings status.readyReplicas
... 1 @{trustyai_replicasets_info}

Verify TrustyAI Container Names
[Documentation] Verifies RHODS TrustyAI deployment
@{trustyai} = Oc Get kind=Pod namespace=${TRUSTYAI_NS} api_version=v1
... label_selector=app.kubernetes.io/part-of=kserve
${containerNames} = Create List kube-rbac-proxy manager
Verify Deployment ${trustyai} 1 1 ${containerNames}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Resource ../../../Resources/RHOSi.resource
Resource ../../../Resources/ODS.robot
Resource ../../../Resources/Common.robot
Resource ../../../Resources/Page/OCPDashboard/OCPDashboard.resource
Resource ../../../Resources/Page/OCPDashboard/Monitoring/Metrics.robot
Resource ../../../Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot
Resource ../../../Resources/Page/ODH/JupyterHub/JupyterHubSpawner.robot
Resource ../../../Resources/Page/OCPLogin/OCPLogin.resource
Expand Down Expand Up @@ -165,35 +166,6 @@ Skip Test If Previous CPU Usage Is Not Zero
... The previos CPU usage is not zero. Current CPU usage: ${metrics_value}. Skiping test
END

Run OpenShift Metrics Query
[Documentation] Runs a query in the Monitoring section of Open Shift
... Note: in order to run this keyword OCP_ADMIN_USER.USERNAME needs to
... belong to a group with "view" role in OpenShift
... Example command to assign the role: oc adm policy add-cluster-role-to-group view rhods-admins
[Arguments] ${query} ${retry_attempts}=10 ${return_zero_if_result_empty}=False
Open OCP Console
LoginPage.Login To Openshift ${OCP_ADMIN_USER.USERNAME} ${OCP_ADMIN_USER.PASSWORD} ${OCP_ADMIN_USER.AUTH_TYPE}
OCPMenu.Switch To Administrator Perspective

# In OCP 4.9 metrics are under the Observe menu (it was called Monitoring in 4.8)
${menu_observe_exists} = Run Keyword and Return Status Menu.Page Should Contain Menu Observe
IF ${menu_observe_exists}
Menu.Navigate To Page Observe Metrics
ELSE
${menu_monitoring_exists} = Run Keyword and Return Status Menu.Page Should Contain Menu Monitoring
IF ${menu_monitoring_exists}
Menu.Navigate To Page Monitoring Metrics
ELSE
Fail
... msg=${OCP_ADMIN_USER.USERNAME} can't see the Observe/Monitoring section in OpenShift Console, please make sure it belongs to a group with "view" role
END
END

Metrics.Verify Page Loaded
Metrics.Run Query ${query} ${retry_attempts}
${result} = Metrics.Get Query Results return_zero_if_result_empty=${return_zero_if_result_empty}
RETURN ${result}

Verify Previus CPU Usage Is Greater Than Zero
[Documentation] Verifies the cpu usage is greater than zero
${metrics_value} = Run OpenShift Metrics Query ${METRIC_RHODS_CPU}
Expand Down
Loading

0 comments on commit a7c1e01

Please sign in to comment.