Skip to content

Commit

Permalink
fix: new Connection Types feature issues (#2034)
Browse files Browse the repository at this point in the history
* fix: new Connection Types feature issues

* fix lintings

* fix pipelines tests
  • Loading branch information
FedeAlonso authored Nov 15, 2024
1 parent 9c97d9c commit db27230
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ Resource Projects.resource


*** Variables ***
${S3_NAME_DC_INPUT_XP}= xpath=//input[@aria-label="Field list Name"]
${S3_KEY_DC_INPUT_XP}= xpath=//input[@aria-label="Field list AWS_ACCESS_KEY_ID"]
${S3_SECRET_DC_INPUT_XP}= xpath=//input[@aria-label="Field list AWS_SECRET_ACCESS_KEY"]
${S3_ENDPOINT_DC_INPUT_XP}= xpath=//input[@aria-label="Field list AWS_S3_ENDPOINT"]
${S3_REGION_DC_INPUT_XP}= xpath=//input[@aria-label="Field list AWS_DEFAULT_REGION"]
${DC_SECTION_XP}= xpath=//section[@id="data-connections"]
${DC_ADD_BTN_1_XP}= xpath=//*[@data-testid="add-data-connection-button"]
${S3_BUCKET_DC_INPUT_XP}= xpath=//*[@data-testid="field AWS_S3_BUCKET"]
${S3_DC_ADD_BTN}= xpath=//*[@data-testid="data-connection-submit-button"]
${S3_DC_EDIT_BTN}= xpath=//footer/button[.="Update data connection"]
${DC_WORKBENCH_SELECTOR_XP}= xpath=//div[@data-testid="connect-existing-workbench-group"]//ul/li
${S3_NAME_DC_INPUT}= xpath=//input[@data-testid="connection-name-desc-name"]
${S3_KEY_DC_INPUT}= xpath=//div[@data-testid="field short-text AWS_ACCESS_KEY_ID"]//input
${S3_SECRET_DC_INPUT}= xpath=//div[@data-testid="field hidden AWS_SECRET_ACCESS_KEY"]//input
${S3_ENDPOINT_DC_INPUT}= xpath=//div[@data-testid="field short-text AWS_S3_ENDPOINT"]//input
${S3_REGION_DC_INPUT}= xpath=//div[@data-testid="field short-text AWS_DEFAULT_REGION"]//input
${DC_SECTION}= xpath=//section[@id="data-connections"]
${DC_ADD_BTN_1}= xpath=//*[@data-testid="create-connection-button"]
${DC_ADD_BTN_2}= xpath=//button[@data-testid="add-connection-button"]
${S3_BUCKET_DC_INPUT}= xpath=//div[@data-testid="field short-text AWS_S3_BUCKET"]//input
${S3_DC_SUBMIT_BTN}= xpath=//*[@data-testid="modal-submit-button"]
${DC_WORKBENCH_SELECTOR}= xpath=//div[@data-testid="connect-existing-workbench-group"]//ul/li
${CONNECTION_TYPE_DROPDOWN}= xpath=//label[@for="connection-type"]/parent::div/parent::div//input


*** Keywords ***
Expand All @@ -25,11 +26,17 @@ Create S3 Data Connection
[Arguments] ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access}
... ${aws_s3_endpoint}=${S3.AWS_DEFAULT_ENDPOINT} ${aws_region}=${S3.AWS_DEFAULT_REGION}
... ${connected_workbench}=${NONE} ${press_cancel}=${FALSE} ${aws_bucket_name}=${NONE}
Open Data Science Project Details Page project_title=${project_title} tab_id=data-connections
Wait Until Element Is Visible ${DC_ADD_BTN_1_XP} timeout=30s
Click Button ${DC_ADD_BTN_1_XP}
Open Data Science Project Details Page project_title=${project_title} tab_id=connections
# The button has two different possitions depending on if there are already created connections
${btn_2_is_shown}= Run Keyword And Return Status Element Should Be Visible ${DC_ADD_BTN_2}
IF ${btn_2_is_shown}
Click Element ${DC_ADD_BTN_2}
ELSE
Click Element ${DC_ADD_BTN_1}
END
Select Connection Type From Add Connection Modal S3 compatible object storage - v1
Fill Data Connection Form ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access}
... ${S3_DC_ADD_BTN} aws_s3_endpoint=${aws_s3_endpoint} aws_region=${aws_region}
... ${S3_DC_SUBMIT_BTN} aws_s3_endpoint=${aws_s3_endpoint} aws_region=${aws_region}
... connected_workbench=${connected_workbench} press_cancel=${press_cancel}
... aws_bucket_name=${aws_bucket_name}

Expand All @@ -38,9 +45,9 @@ Edit S3 Data Connection
[Arguments] ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access} ${new_dc_name}=${dc_name}
... ${aws_s3_endpoint}=${S3.AWS_DEFAULT_ENDPOINT} ${aws_region}=${S3.AWS_DEFAULT_REGION}
... ${connected_workbench}=${NONE} ${press_cancel}=${FALSE} ${aws_bucket_name}=${NONE}
ODHDashboard.Click Action From Actions Menu item_title=${dc_name} item_type=data connection action=Edit
ODHDashboard.Click Action From Actions Menu item_title=${dc_name} action=Edit
Fill Data Connection Form ${project_title} ${new_dc_name} ${aws_access_key} ${aws_secret_access}
... ${S3_DC_EDIT_BTN} aws_s3_endpoint=${aws_s3_endpoint} aws_region=${aws_region}
... ${S3_DC_SUBMIT_BTN} aws_s3_endpoint=${aws_s3_endpoint} aws_region=${aws_region}
... connected_workbench=${connected_workbench} press_cancel=${press_cancel}
... aws_bucket_name=${aws_bucket_name}

Expand All @@ -49,31 +56,31 @@ Set Connection Between Data Connection And Workbench
[Arguments] ${workbench_title}
Wait Until Element Is Enabled xpath=//button[@aria-label="Notebook select"]
Click Element xpath=//button[@aria-label="Notebook select"]
Wait Until Page Contains Element ${DC_WORKBENCH_SELECTOR_XP}/button[.="${workbench_title}"]
Click Element ${DC_WORKBENCH_SELECTOR_XP}/button[.="${workbench_title}"]
Wait Until Page Contains Element ${DC_WORKBENCH_SELECTOR}/button[.="${workbench_title}"]
Click Element ${DC_WORKBENCH_SELECTOR}/button[.="${workbench_title}"]

Data Connection Should Be Listed
[Documentation] Checks a Data Connection is listed in DS Project details page
[Arguments] ${name} ${type} ${connected_workbench}
${connection_xp}= Set Variable ${DC_SECTION_XP}//tr[td[@data-label="Name"]//div[.="${name}"]]
Run Keyword And Continue On Failure Page Should Contain Element ${connection_xp}
Run Keyword And Continue On Failure Page Should Contain Element ${connection_xp}/td[.=" ${type}"]
${connection}= Set Variable ${DC_SECTION}//tr[td[@data-label="Name"]//div[.="${name}"]]
Run Keyword And Continue On Failure Page Should Contain Element ${connection}
Run Keyword And Continue On Failure Page Should Contain Element ${connection}/td[.=" ${type}"]
IF "${connected_workbench}" == "${NONE}"
Run Keyword And Continue On Failure Page Should Contain Element
... ${connection_xp}/td[.="No connections"]
... ${connection}/td[.="No connections"]
ELSE
FOR ${index} ${workbench_title} IN ENUMERATE @{connected_workbench}
Log ${index}: ${workbench_title}
Run Keyword And Continue On Failure Page Should Contain Element
... ${connection_xp}/td[@data-label="Connected workbenches"]//*[.="${workbench_title}"]
... ${connection}/td[@data-label="Connected workbenches"]//*[.="${workbench_title}"]
END
END

Data Connection Should Not Be Listed
[Documentation] Checks a Data Connection is not listed in DS Project details page
[Arguments] ${name}
Run Keyword And Continue On Failure Wait Until Page Does Not Contain Element
... ${DC_SECTION_XP}//tr[td[@data-label="Name"]/*/div[.="${name}"]]
... ${DC_SECTION}//tr[td[@data-label="Name"]/*/div[.="${name}"]]

Get Openshift Secret From Data Connection
[Documentation] Retrieves name of Openshift secret corresponding to a given S3 Data Connection based on Dispayed name in DS Project details page
Expand All @@ -84,33 +91,33 @@ Get Openshift Secret From Data Connection
Delete Data Connection
[Documentation] Deletes a Data Connection from DS Project details page
[Arguments] ${name} ${press_cancel}=${FALSE}
ODHDashboard.Click Action From Actions Menu item_title=${name} item_type=data connection action=Delete
ODHDashboard.Click Action From Actions Menu item_title=${name} action=Delete
Handle Deletion Confirmation Modal item_title=${name} item_type=data connection press_cancel=${press_cancel}

Fill Data Connection Form
[Documentation] Data Connection Form can be used in the create or edit
[Arguments] ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access} ${action_btn}
... ${aws_s3_endpoint}=${S3.AWS_DEFAULT_ENDPOINT} ${aws_region}=${S3.AWS_DEFAULT_REGION}
... ${connected_workbench}=${NONE} ${press_cancel}=${FALSE} ${aws_bucket_name}=${NONE}
Wait Until Page Contains Element ${S3_NAME_DC_INPUT_XP}
Input Text ${S3_NAME_DC_INPUT_XP} ${dc_name}
Input Text ${S3_KEY_DC_INPUT_XP} ${aws_access_key}
Input Text ${S3_SECRET_DC_INPUT_XP} ${aws_secret_access}
Input Text ${S3_ENDPOINT_DC_INPUT_XP} ${aws_s3_endpoint}
Input Text ${S3_REGION_DC_INPUT_XP} ${aws_region}
Input Text ${S3_BUCKET_DC_INPUT_XP} ${aws_bucket_name}
Wait Until Page Contains Element ${S3_NAME_DC_INPUT}
Input Text ${S3_NAME_DC_INPUT} ${dc_name}
Input Text ${S3_KEY_DC_INPUT} ${aws_access_key}
Input Text ${S3_SECRET_DC_INPUT} ${aws_secret_access}
Input Text ${S3_ENDPOINT_DC_INPUT} ${aws_s3_endpoint}
Input Text ${S3_REGION_DC_INPUT} ${aws_region}
Input Text ${S3_BUCKET_DC_INPUT} ${aws_bucket_name}
IF "${connected_workbench}" == "${NONE}"
Log msg=you are not connecting any workbenchs to ${dc_name} DataConnection
ELSE
Run Keyword And Continue On Failure
... Element Should Be Enabled xpath=//div[contains(@class,"modal")]//button[@aria-label="Notebook select"]
FOR ${workbench_title} IN @{connected_workbench}
Set Connection Between Data Connection And Workbench ${workbench_title}
Run Keyword And Continue On Failure Element Should Be Enabled ${S3_DC_ADD_BTN}
Run Keyword And Continue On Failure Element Should Be Enabled ${S3_DC_SUBMIT_BTN}
END
END
IF ${press_cancel} == ${TRUE}
Click Button ${GENERIC_CANCEL_BTN_XP}
Click Button ${GENERIC_CANCEL_BTN}
ELSE
Wait Until Element Is Enabled ${action_btn}
Click Button ${action_btn}
Expand All @@ -120,24 +127,24 @@ Fill Data Connection Form

Get Data Connection Form Values
[Arguments] ${dc_name}
ODHDashboard.Click Action From Actions Menu item_title=${dc_name} item_type=data connection action=Edit
Wait Until Page Contains Element ${S3_NAME_DC_INPUT_XP}
${s3_name} get element attribute ${S3_NAME_DC_INPUT_XP} value
${s3_key} get element attribute ${S3_KEY_DC_INPUT_XP} value
${s3_secret} get element attribute ${S3_SECRET_DC_INPUT_XP} value
${s3_endpoint} get element attribute ${S3_ENDPOINT_DC_INPUT_XP} value
${s3_region} get element attribute ${S3_REGION_DC_INPUT_XP} value
${s3_bucket} get element attribute ${S3_BUCKET_DC_INPUT_XP} value
ODHDashboard.Click Action From Actions Menu item_title=${dc_name} action=Edit
Wait Until Page Contains Element ${S3_NAME_DC_INPUT}
${s3_name} Get Element Attribute ${S3_NAME_DC_INPUT} value
${s3_key} Get Element Attribute ${S3_KEY_DC_INPUT} value
${s3_secret} Get Element Attribute ${S3_SECRET_DC_INPUT} value
${s3_endpoint} Get Element Attribute ${S3_ENDPOINT_DC_INPUT} value
${s3_region} Get Element Attribute ${S3_REGION_DC_INPUT} value
${s3_bucket} Get Element Attribute ${S3_BUCKET_DC_INPUT} value
[return] ${s3_name} ${s3_key} ${s3_secret} ${s3_endpoint} ${s3_region} ${s3_bucket}

Recreate S3 Data Connection
[Documentation] Edit Exisisting Or Create New S3 Data Connection from DS Project details page
[Arguments] ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access}
... ${aws_s3_endpoint}=${S3.AWS_DEFAULT_ENDPOINT} ${aws_region}=${S3.AWS_DEFAULT_REGION}
... ${connected_workbench}=${NONE} ${press_cancel}=${FALSE} ${aws_bucket_name}=${NONE}
Open Data Science Project Details Page project_title=${project_title} tab_id=data-connections
Open Data Science Project Details Page project_title=${project_title} tab_id=connections
${is_exist}= Run Keyword And Return Status
... Wait Until Page Contains Element ${DC_SECTION_XP}//tr[td[@data-label="Name"]/*/div[.="${dc_name}"]]
... Wait Until Page Contains Element ${DC_SECTION}//tr[td[@data-label="Name"]/*/div[.="${dc_name}"]]
IF ${is_exist}
Log Data Connection '${dc_name}' already exists, updating connection console=True
Edit S3 Data Connection project_title=${project_title} dc_name=${dc_name} new_dc_name=${dc_name}${SPACE}
Expand All @@ -152,3 +159,12 @@ Recreate S3 Data Connection
... aws_s3_endpoint=${aws_s3_endpoint}
... connected_workbench=${connected_workbench}
END

Select Connection Type From Add Connection Modal
[Documentation] Select connection type from Add Connection modal
[Arguments] ${connection_type}
Wait Until Page Contains Element xpath=//header/h1/span[text()="Add connection"]
Wait Until Page Contains Element ${CONNECTION_TYPE_DROPDOWN}
Click Element ${CONNECTION_TYPE_DROPDOWN}
Sleep 1 reason=Sometimes it takes a little bit longer to finish rendering all the dropdown content
Click Element xpath=//div[@id="connection-type"]//button//span[text()="${connection_type}"]
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Is Data Science Projects Page Open

Open Data Science Project Details Page
[Documentation] Open project ${project_title} in the "Data Science Projects" page, and an optional Tab by ID:
... overview | workbenches | cluster-storages | data-connections | pipelines-projects | model-server | permissions # robocop: disable
... overview | workbenches | cluster-storages | connections | pipelines-projects | model-server | permissions # robocop: disable
[Arguments] ${project_title} ${tab_id}=${NONE}
${is_project_open}= Is Data Science Project Details Page Open project_title=${project_title}
IF ${is_project_open} == ${FALSE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ${WORKBENCH_IMAGE_VER_DROPDOWN}= //*[@id="workbench-image-version-selection"
${KEYVALUE_TYPE}= Key / value
${UPLOAD_TYPE}= Upload
${ENV_VARIABLES_SECTION_XP}= xpath=//section[@aria-label="Environment variables"]
${ENV_DATA_CONNECTION_SECTION_XP}= xpath=//section[@aria-label="Data connections"]
${ENV_DATA_CONNECTION_SECTION_XP}= xpath=//section[@aria-label="Connections"]
${ERROR_ICON_XP}= span[contains(@class,'pf-m-danger')]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Verify User Can Create A S3 Data Connection And Connect It To Workbenches
Stop Workbench workbench_title=${WORKBENCH_2_TITLE} from_running=${FALSE}
Wait Until Workbench Is Started workbench_title=${WORKBENCH_TITLE}
${ns_name}= Get Openshift Namespace From Data Science Project project_title=${PRJ_TITLE}
Open Data Science Project Details Page project_title=${PRJ_TITLE} tab_id=data-connections
Open Data Science Project Details Page project_title=${PRJ_TITLE} tab_id=connections
Create S3 Data Connection project_title=${PRJ_TITLE} dc_name=${DC_S3_NAME}
... aws_access_key=${DC_S3_AWS_SECRET_ACCESS_KEY}
... aws_secret_access=${DC_S3_AWS_SECRET_ACCESS_KEY}
Expand Down Expand Up @@ -273,7 +273,7 @@ Verify user can create a workbench with an existing data connection
Workbench Should Be Listed workbench_title=${WORKBENCH_TITLE}
# The data connection has the workbench name in the "Connected workbenches" column
${workbenches}= Create List ${WORKBENCH_TITLE}
Open Data Science Project Details Page project_title=${PRJ_TITLE} tab_id=data-connections
Open Data Science Project Details Page project_title=${PRJ_TITLE} tab_id=connections
Data Connection Should Be Listed name=${data_connection_name} type=${DC_S3_TYPE}
... connected_workbench=${workbenches}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Verify User Can Edit A Workbench
Verify User Can Edit A S3 Data Connection
[Tags] Sanity Tier1 ODS-1932
[Documentation] Verifies users can add a Data connection to AWS S3
[Setup] Open Data Science Project Details Page project_title=${PRJ_TITLE} tab_id=data-connections
[Setup] Open Data Science Project Details Page project_title=${PRJ_TITLE} tab_id=connections
Create S3 Data Connection project_title=${PRJ_TITLE} dc_name=${DC_S3_NAME}
... aws_access_key=${DC_S3_AWS_SECRET_ACCESS_KEY}
... aws_secret_access=${DC_S3_AWS_SECRET_ACCESS_KEY}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Verify RHODS Users Can Deploy A Model Using A Custom Serving Runtime # roboco
${model_name}= Set Variable test-model-csr
${inference_input}= Set Variable @tests/Resources/Files/modelmesh-mnist-input.json
${exp_inference_output}= Set Variable {"model_name":"test-model-csr__isvc-85fe09502b","model_version":"1","outputs":[{"name":"Plus214_Output_0","datatype":"FP32","shape":[1,10],"data":[-8.233053,-7.7497034,-3.4236815,12.3630295,-12.079103,17.266596,-10.570976,0.7130762,3.321715,1.3621228]}]} # robocop: off=line-too-long
Open Data Science Project Details Page project_title=${PRJ_TITLE} tab_id=data-connections
Open Data Science Project Details Page project_title=${PRJ_TITLE} tab_id=connections
Create S3 Data Connection project_title=${PRJ_TITLE} dc_name=model-serving-connection
... aws_access_key=${S3.AWS_ACCESS_KEY_ID} aws_secret_access=${S3.AWS_SECRET_ACCESS_KEY}
... aws_bucket_name=ods-ci-s3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Pipelines Suite Setup

Create Data Science Project title=${PRJ_TITLE}
... description=${PRJ_DESCRIPTION}
Projects.Move To Tab Data connections
Projects.Move To Tab Connections
Create S3 Data Connection project_title=${PRJ_TITLE} dc_name=${DC_NAME}
... aws_access_key=${S3.AWS_ACCESS_KEY_ID} aws_secret_access=${S3.AWS_SECRET_ACCESS_KEY}
... aws_bucket_name=ods-ci-ds-pipelines
Expand Down

0 comments on commit db27230

Please sign in to comment.