Skip to content
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

WIP: Add ModelMesh test for CVE-2024-7557 #1861

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
8ce98fd
Add tests
rnetser Sep 18, 2024
73b24a5
add modelmesh tests
rnetser Sep 18, 2024
98c215d
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 19, 2024
8bb6f88
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 22, 2024
3f83bc6
add modelmesh tests
rnetser Sep 23, 2024
a7121e4
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 23, 2024
b82028d
add modelmesh tests
rnetser Sep 24, 2024
d5feec2
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 24, 2024
8000cbb
add modelmesh tests
rnetser Sep 24, 2024
2c0720d
add modelmesh tests
rnetser Sep 24, 2024
118abdd
add modelmesh tests
rnetser Sep 24, 2024
cdbb779
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 24, 2024
f7d526c
add modelmesh tests
rnetser Sep 25, 2024
4048abf
add modelmesh tests
rnetser Sep 25, 2024
4409b52
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 25, 2024
1e8f59b
add modelmesh tests
rnetser Sep 26, 2024
4c2a0fa
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 26, 2024
15c0e39
add modelmesh tests
rnetser Sep 26, 2024
35fe0d1
add modelmesh tests
rnetser Sep 26, 2024
62cb00e
add modelmesh tests
rnetser Sep 26, 2024
db2230e
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 26, 2024
ccd8051
add modelmesh tests
rnetser Sep 26, 2024
a8d618a
add modelmesh tests
rnetser Sep 26, 2024
09f70d0
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 29, 2024
bcabc3c
resolve robocop comments
rnetser Sep 29, 2024
dba77d1
fix comments
rnetser Sep 29, 2024
aad7b58
fix comments
rnetser Sep 29, 2024
a3b1727
fix assign
rnetser Sep 30, 2024
ad89501
add runtime to token from ui
rnetser Sep 30, 2024
d7bfab1
add runtime to token from ui
rnetser Sep 30, 2024
d4a4a38
add runtime to token from ui
rnetser Sep 30, 2024
08f2918
add runtime to token from ui
rnetser Sep 30, 2024
7891842
add runtime to token from ui
rnetser Sep 30, 2024
4f57e46
add runtime to token from ui
rnetser Sep 30, 2024
c3a830d
update paths in project
rnetser Sep 30, 2024
001b8c8
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Sep 30, 2024
2db9d62
address robocop comments
rnetser Sep 30, 2024
5827368
fix ui
rnetser Oct 1, 2024
dfe44cb
Merge branch 'master' of https://github.com/red-hat-data-services/ods…
rnetser Oct 1, 2024
846f459
fix ui
rnetser Oct 1, 2024
78fe13f
update 2.13
rnetser Oct 1, 2024
2cfb81d
update 2.13
rnetser Oct 1, 2024
6d29aef
update 2.13
rnetser Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@
*** Keywords ***
Create Model Server
[Documentation] Keyword to create a Model Server in a Data Science Project
[Arguments] ${no_replicas}=1 ${server_size}=Small ${ext_route}=${TRUE}
... ${token}=${TRUE} ${runtime}=OpenVINO Model Server ${server_name}=Model Serving Test
... ${no_gpus}=0 ${existing_server}=${FALSE}
[Arguments] ${no_replicas}=1
... ${server_size}=Small
... ${ext_route}=${TRUE}
... ${token}=${TRUE}
... ${runtime}=OpenVINO Model Server
... ${server_name}=Model Serving Test
... ${no_gpus}=0
... ${existing_server}=${FALSE}
... ${service_account_name}=${NONE}
Move To Tab Models
IF ${existing_server}
${existing_server}= Run Keyword And Return Status Wait Until Page Contains Element //button[.="${server_name}"]
Expand Down Expand Up @@ -63,8 +69,9 @@
Log message=Token Auth should be enabled by default..(from v2.5)
SeleniumLibrary.Checkbox Should Be Selected ${TOKEN_AUTH_CHECKBOX_XP}
END
ELSE IF ${token}==${TRUE}
Enable Token Authentication
END
IF ${token}
Enable Token Authentication service_account_name=${service_account_name}
END
SeleniumLibrary.Wait Until Element Is Enabled //button[contains(text(),"Add")]
SeleniumLibrary.Click Button Add
Expand Down Expand Up @@ -181,9 +188,10 @@
[Documentation] Enables Token authentication to serving route
[Arguments] ${service_account_name}=${NONE}
SeleniumLibrary.Select Checkbox ${TOKEN_AUTH_CHECKBOX_XP}
IF "${service_account_name}" != "${NONE}"
Input Service Account Name ${service_account_name}
IF "${service_account_name}" == "${NONE}"
${service_account_name}= Set Variable default-name
END
Input Service Account Name ${service_account_name}

Disable Token Authentication
[Documentation] Disable Token authentication to serving route
Expand Down Expand Up @@ -211,14 +219,30 @@
Get Model Serving Access Token via UI
[Documentation] Returns the token used for authentication to the serving route
... TODO: There can be multiple tokens defined for each model server, handle this case as well
[Arguments] ${service_account_name}=default-name ${single_model}=${FALSE} ${model_name}=${NONE}
[Arguments] ${service_account_name}=default-name ${single_model}=${FALSE}

Check notice

Code scanning / Robocop

There is too many arguments per continuation line ({{ arguments_count }} / {{ max_arguments_count }}) Note test

There is too many arguments per continuation line (2 / 1)
... ${model_name}=${NONE} ${multi_model_servers}=${FALSE}
Dismissed Show dismissed Hide dismissed
IF ${single_model}
# Expand the model
SeleniumLibrary.Click Button xpath: //a[text()='${model_name}']/parent::div/parent::td[@data-label='Name']/preceding-sibling::td/button # robocop: off=line-too-long
${token}= Get Single Model Token ${service_account_name}
ELSE
SeleniumLibrary.Wait Until Page Contains Element xpath://td[@data-label="Tokens"]/button
SeleniumLibrary.Click Element xpath://td[@data-label="Tokens"]/button
# TODO: ModelMesh requires passing model server name and not model name;
# in particular when there are multiple model servers
# in the same project.
# This is a temporary workaround until the issue is fixed.
# With one model server, the model name is not required.
IF ${multi_model_servers}
SeleniumLibrary.Click Button
... xpath://*[@id="expand-table-row-${model_name}-1-undefined-1"]/../../td[@data-label='Tokens']//button
ELSE
SeleniumLibrary.Click Element xpath://td[@data-label="Tokens"]/button
END
# TODO: service account name is required; remove from all places that pass `None`
IF "${service_account_name}" == "${NONE}"
${service_account_name}= Set Variable default-name
END

${token}= SeleniumLibrary.Get Element Attribute
... xpath://div[.="${service_account_name} "]/../../td[@data-label="Token Secret"]//input value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xpath can be inproved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwaykole please advise how

END
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# robocop: off=wrong-case-in-keyword-name,too-many-arguments,too-long-keyword
# robocop: off=wrong-case-in-keyword-name,too-many-arguments,too-long-keyword,line-too-long

Check warning

Code scanning / Robocop

Inconsistent use of tabs and spaces in file Warning test

Inconsistent use of tabs and spaces in file
*** Settings ***
Documentation Collection of keywords to interact with Model Serving
Resource ../../../Page/Components/Components.resource
Expand Down Expand Up @@ -75,26 +75,10 @@
SeleniumLibrary.Click Button ${DEPLOY_MODEL_BTN}
END
SeleniumLibrary.Wait Until Page Contains Element //div[@role="dialog"]
Set Model Name ${model_name}
Select Model Server ${model_server}
IF "${serving_runtime}" != "${NONE}" Set Model Server Runtime ${serving_runtime}
SeleniumLibrary.Wait Until Page Contains Element xpath://span[.="Model framework (name - version)"]
Select Framework ${framework}
IF ${existing_data_connection}==${TRUE}
# Select Radio Button group_name=radiogroup value=existing-data-connection-radio
# Selected by default, let's skip for now
Select Existing Data Connection ${data_connection_name}
Set Folder Path ${model_path}
ELSE
# Existing connection radio is selected by default; for now blindly click on new connection radio
SeleniumLibrary.Click Element //input[@id="new-data-connection-radio"]
# Select Radio Button group_name=radiogroup value=new-data-connection-radio
Set Up New Data Connection dc_name=${data_connection_name}
Set Folder Path ${model_path}
END
SeleniumLibrary.Wait Until Element Is Enabled //button[contains(text(),"Deploy")]
SeleniumLibrary.Click Button Deploy
SeleniumLibrary.Wait Until Page Does Not Contain xpath://h1[.="Deploy model"]
Fill Deploy Model Form model_name=${model_name} model_server=${model_server}
... serving_runtime=${serving_runtime} framework=${framework}
... data_connection_name=${data_connection_name} existing_data_connection=${existing_data_connection}
... model_path=${model_path}

Select Project
[Documentation] Selects a project in the "deploy model" modal.
Expand Down Expand Up @@ -244,10 +228,12 @@
Get Access Token Via UI
[Documentation] Returns the access token for models deployed in a specific project
... by using the UI of DSP
[Arguments] ${project_name} ${service_account_name}=default-name ${single_model}=${FALSE}
... ${model_name}=${NONE}
[Arguments] ${project_name} ${service_account_name}=default-name

Check notice

Code scanning / Robocop

There is too many arguments per continuation line ({{ arguments_count }} / {{ max_arguments_count }}) Note test

There is too many arguments per continuation line (2 / 1)
... ${single_model}=${FALSE} ${model_name}=${NONE}

Check notice

Code scanning / Robocop

There is too many arguments per continuation line ({{ arguments_count }} / {{ max_arguments_count }}) Note test

There is too many arguments per continuation line (2 / 1)
... ${multi_model_servers}=${FALSE}
Open Data Science Project Details Page ${project_name} tab_id=model-server
${token}= Get Model Serving Access Token via UI ${service_account_name} ${single_model} ${model_name}
... ${multi_model_servers}
RETURN ${token}

Get Model Project
Expand Down Expand Up @@ -387,18 +373,11 @@
[Documentation] Deletes all currently deployed models, if any are present.
# Returns an empty list if no matching elements found
Switch Model Serving Project project_name=All projects
${projects}= Get WebElements xpath://table/tbody/tr/td[@data-label="Project"]
FOR ${project} IN @{projects}
${project}= Get Text ${project}
@{project description}= Split String ${project}
Switch Model Serving Project ${project description}[0]
${models}= Get WebElements xpath://table/tbody/tr/td[@data-label="Name"]/div/a
FOR ${model} IN @{models}
${model}= Get Text ${model}
Delete Model Via UI ${model}
Sleep 1s
END
Switch Model Serving Project project_name=All projects
${models}= Get WebElements xpath://table/tbody/tr/td[@data-label="Name"]/div/a
FOR ${model} IN @{models}
${model}= Get Text ${model}
Delete Model Via UI ${model}
Sleep 1s
END

Add Namespace To ServiceMeshMemberRoll
Expand Down Expand Up @@ -643,3 +622,53 @@
ELSE
Log message=Skipping UserWorkloadMonitoring enablement.
END

Deploy Model From Models Tab
[Documentation] Deploys a model from the project's Models tab
[Arguments] ${project_name}
... ${data_connection_name}
... ${model_name}
... ${framework}
... ${existing_data_connection}
... ${model_path}
... ${model_server}
... ${serving_runtime}=${NONE}
Open Data Science Project Details Page ${project_name} tab_id=model-server
SeleniumLibrary.Click Button
... xpath://*[@id="expand-table-row-${model_name}-1-undefined-1"]/../../td[@class='pf-v5-c-table__td']//button
SeleniumLibrary.Wait Until Page Contains Element //div[@role="dialog"]
Fill Deploy Model Form model_name=${model_name} model_server=${model_server}
... serving_runtime=${serving_runtime} framework=${framework}
... data_connection_name=${data_connection_name} existing_data_connection=${existing_data_connection}
... model_path=${model_path}

Fill Deploy Model Form # robocop: off=too-many-calls-in-keyword
[Documentation] Fills the deploy model form
[Arguments] ${model_name}
... ${model_server}
... ${serving_runtime}
... ${framework}
... ${data_connection_name}
... ${existing_data_connection}
... ${model_path}
Set Model Name ${model_name}
Select Model Server ${model_server}
IF "${serving_runtime}" != "${NONE}" Set Model Server Runtime ${serving_runtime}
SeleniumLibrary.Wait Until Page Contains Element
... xpath://span[.="Model framework (name - version)"]
Select Framework ${framework}
IF ${existing_data_connection}
# Select Radio Button group_name=radiogroup value=existing-data-connection-radio
# Selected by default, let's skip for now
Select Existing Data Connection ${data_connection_name}
Set Folder Path ${model_path}
ELSE
# Existing connection radio is selected by default; for now blindly click on new connection radio
SeleniumLibrary.Click Element //input[@id="new-data-connection-radio"]
# Select Radio Button group_name=radiogroup value=new-data-connection-radio
Set Up New Data Connection dc_name=${data_connection_name}
Set Folder Path ${model_path}
END
SeleniumLibrary.Wait Until Element Is Enabled //button[contains(text(),"Deploy")]
SeleniumLibrary.Click Button Deploy
SeleniumLibrary.Wait Until Page Does Not Contain xpath://h1[.="Deploy model"]

Check warning

Code scanning / Robocop

File has too many lines ({{ lines_count }}/{{max_allowed_count }}) Warning test

File has too many lines (674/400)
Loading
Loading