Skip to content

Commit

Permalink
Add event log test plus refine data connection tests in DS Projects (#…
Browse files Browse the repository at this point in the history
…674)

* add workbench connection to dc

Signed-off-by: bdattoma <[email protected]>

* add ODS-1972 tag

Signed-off-by: bdattoma <[email protected]>

* first draft of ODS-1973

Signed-off-by: bdattoma <[email protected]>

* first part of 1973 - error icon

Signed-off-by: bdattoma <[email protected]>

* final version of 1973

Signed-off-by: bdattoma <[email protected]>

* add ODS-1970

Signed-off-by: bdattoma <[email protected]>

* add wait for start when s3 dc added

Signed-off-by: bdattoma <[email protected]>

* fix second s3 dc name

Signed-off-by: bdattoma <[email protected]>

* increase timeout + fix exp status ODS-1972

Signed-off-by: bdattoma <[email protected]>

* increase timeout for 1973

Signed-off-by: bdattoma <[email protected]>

* add page reload before checking the alert

Signed-off-by: bdattoma <[email protected]>

* move reload page in kw

Signed-off-by: bdattoma <[email protected]>

* set 1973 as automation bug

Signed-off-by: bdattoma <[email protected]>

* rename ODS-1972

Signed-off-by: bdattoma <[email protected]>

* ix robocop alerts

Signed-off-by: bdattoma <[email protected]>

Signed-off-by: bdattoma <[email protected]>
  • Loading branch information
bdattoma authored Jan 20, 2023
1 parent 99674d9 commit cd70161
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ${KFNBC_GPU_DROPDOWN_XPATH} = //button[contains(@aria-labelledby, "gpu-number
${KFNBC_MODAL_HEADER_XPATH} = //div[@aria-label="Starting server modal"]
${KFNBC_MODAL_CANCEL_XPATH} = ${KFNBC_MODAL_HEADER_XPATH}//button[.="Cancel"]
${KFNBC_MODAL_CLOSE_XPATH} = ${KFNBC_MODAL_HEADER_XPATH}//button[.="Close"]
${KFNBC_MODAL_X_XPATH} = ${KFNBC_MODAL_HEADER_XPATH}//button[@aria-label="Close"]
${KFNBC_CONTROL_PANEL_HEADER_XPATH} = //h1[.="Notebook server control panel"]
${KFNBC_ENV_VAR_NAME_PRE} = //span[.="Variable name"]/../../../div[@class="pf-c-form__group-control"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ${DC_ADD_BTN_1_XP}= ${DC_SECTION_XP}/div/button[text()="Add data conne
${DC_ADD_BTN_2_XP}= xpath=//footer/button[text()="Add data connection"]
${S3_BUCKET_DC_INPUT_XP}= xpath=//input[@aria-label="AWS field AWS_S3_BUCKET"]
${S3_DC_ADD_BTN}= //footer/button[.="Add data connection"]
${DC_WORKBENCH_SELECTOR_XP}= xpath=//div[contains(@class,"modal")]//div[contains(@class,"pf-c-select")]/ul/li


*** Keywords ***
Expand All @@ -35,6 +36,16 @@ Create S3 Data Connection
IF ${version_check}==True
Input Text ${S3_BUCKET_DC_INPUT_XP} ${aws_bucket_name}
END
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")]//div[contains(@class,"pf-c-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}
END
END
IF ${press_cancel} == ${TRUE}
Click Button ${GENERIC_CANCEL_BTN_XP}
ELSE
Expand All @@ -44,6 +55,14 @@ Create S3 Data Connection
Wait Until Generic Modal Disappears
Wait Until Project Is Open project_title=${project_title}

Set Connection Between Data Connection And Workbench
[Documentation] Connects a DataConnection to an existent workbench
[Arguments] ${workbench_title}
Wait Until Element Is Enabled xpath=//button[@aria-label="Options menu"]
Click Element xpath=//button[@aria-label="Options menu"]
Wait Until Page Contains Element ${DC_WORKBENCH_SELECTOR_XP}/button[text()="${workbench_title}"]
Click Element ${DC_WORKBENCH_SELECTOR_XP}/button[text()="${workbench_title}"]

Data Connection Should Be Listed
[Documentation] Checks a Data Connection is listed in DS Project details page
[Arguments] ${name} ${type} ${connected_workbench}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ${WORKBENCH_DESCR_TXT_XP}= xpath=//textarea[@name="workbench-desc
${WORKBENCH_IMAGE_MENU_BTN_XP}= xpath=//section[@id="notebook-image"]//button[@aria-label="Options menu"]
${WORKBENCH_IMAGE_ITEM_BTN_XP}= xpath=//ul[@id="workbench-image-stream-selection"]/li/button
${WORKBENCH_SIZE_MENU_BTN_XP}= xpath=//section[@id="deployment-size"]//button[@aria-label="Options menu"]
${WORKBENCH_SIZE_ITEM_BTN_XP}= xpath=//ul[@id="container-size"]/li/button
${WORKBENCH_SIZE_ITEM_BTN_XP}= xpath=//ul[@data-id="container-size-select"]/li/button
${WORKBENCH_ADD_VAR_BTN_XP}= xpath=//button[text()="Add variable"]
${WORKBENCH_STATUS_STOPPED}= Stopped
${WORKBENCH_STATUS_RUNNING}= Running
Expand All @@ -25,6 +25,7 @@ ${WORKBENCH_STOP_BTN_XP}= xpath=//button[text()="Stop workbench"
... Standard Data Science=s2i-generic-data-science-notebook TensorFlow=tensorflow
${KEYVALUE_TYPE}= Key / value
${ENV_VARIABLES_SECTION_XP}= xpath=//section[@aria-label="Environment variables"]
${ERROR_ICON_XP}= span[contains(@class,'pf-m-danger')]


*** Keywords ***
Expand All @@ -42,7 +43,7 @@ Create Workbench
Input Text ${WORKBENCH_DESCR_TXT_XP} ${workbench_description}
Run Keyword And Continue On Failure Element Should Be Disabled ${WORKBENCH_CREATE_BTN_2_XP}
Select Workbench Jupyter Image image_name=${image_name}
# Select Workbench Container Size # to fix, by default Small is already select
IF "${deployment_size}" != "${NONE}" Select Workbench Container Size size_name=${deployment_size}
IF "${envs}" != "${NONE}"
${envs_copy}= Copy List ${envs} deepcopy=${TRUE}
Add Environment Variables In Workbench env_variables=${envs_copy}
Expand Down Expand Up @@ -178,9 +179,19 @@ Workbench Status Should Be
... Page Should Contain Element
... ${WORKBENCH_SECTION_XP}//tr[td[@data-label="Name"]/h4[div[text()="${workbench_title}"]]]/td[@data-label="Status"]//p[text()="${status}"]

Status Error Icon Should Appear
[Documentation] Checks if the error icon appears on the given workbench
[Arguments] ${workbench_title}
Reload Page
Wait Until Project Is Open project_title=${PRJ_TITLE}
Page Should Contain Element
... ${WORKBENCH_SECTION_XP}//tr[td[@data-label="Name"]/h4[div[text()="${workbench_title}"]]]/td[@data-label="Status"]//p//${ERROR_ICON_XP} # robocop: disable
Mouse Over ${WORKBENCH_SECTION_XP}//tr[td[@data-label="Name"]/h4[div[text()="${workbench_title}"]]]/td[@data-label="Status"]//p//${ERROR_ICON_XP} # robocop: disable
Wait Until Page Contains Insufficient resources to start

Wait Until Workbench Is Started
[Documentation] Waits until workbench status is "RUNNING" in the DS Project details page
[Arguments] ${workbench_title} ${timeout}=30s
[Arguments] ${workbench_title} ${timeout}=40s
Wait Until Keyword Succeeds ${timeout} 5s Workbench Status Should Be
... workbench_title=${workbench_title} status=${WORKBENCH_STATUS_RUNNING}

Expand Down Expand Up @@ -296,4 +307,68 @@ Get Openshift Notebook CR From Workbench
${rc} ${cr_name}= Run And Return Rc And Output oc get notebook -n ${namespace} -o jsonpath='{.items[?(@.metadata.annotations.openshift\\.io/display-name=="${workbench_title}")].metadata.name}'
RETURN ${rc} ${cr_name}

Start Workbench Should Fail
[Documentation] Checks the workbench fails to start
[Arguments] ${workbench_title}
${failed}= Run Keyword And Return Status
... Wait Until Workbench Is Started workbench_title=${workbench_title}
IF ${failed} != ${FALSE} Fail msg=Workbench is expected to fail starting...
Wait Until Keyword Succeeds 20 times 2s
... Status Error Icon Should Appear workbench_title=${workbench_title}

Open Notebook Event Log
[Documentation] Opens the event log of the given workbench
[Arguments] ${workbench_title} ${exp_preview_text}=${NONE}
Click Element
... ${WORKBENCH_SECTION_XP}//tr[td[@data-label="Name"]/h4[div[text()="${workbench_title}"]]]/td[@data-label="Status"]//p[text()="${WORKBENCH_STATUS_STARTING}"] # robocop: disable
Page Should Contain Event Log Preview expected_text=${exp_preview_text}
Click Element xpath=//div[contains(@class,"popover")]//footer/button[text()="Event log"]
Wait Until Generic Modal Appears

Event Log Should Report The Failure
[Documentation] Checks that the Event log modal reports the
... workbench start failure
[Arguments] ${exp_progress_text}=${NONE} ${exp_result_text}=${NONE}
Page Should Contain Event Log expected_progress_text=${exp_progress_text}
... expected_result_text=${exp_result_text}

Close Event Log
[Documentation] Closes the event log which was previously opened by the robot
${cancel_present}= Run Keyword And Return Status
... Page Should Contain Element ${KFNBC_MODAL_CANCEL_XPATH}
IF ${cancel_present} == ${TRUE}
Click Element ${KFNBC_MODAL_CANCEL_XPATH}
ELSE
Click Element ${KFNBC_MODAL_X_XPATH}
END
Wait Until Generic Modal Disappears

Page Should Contain Event Log Preview
[Documentation] Check if a preview of the event log is displayed when
... user clicks on "Starting..." status label
[Arguments] ${expected_text}=${NONE}
Wait Until Page Contains Element xpath=//div[contains(@class,"popover")]//h6[text()="Notebook status"]
IF "${expected_text}" != "${NONE}"
Page Should Contain Element
... xpath=//div[contains(@class,"popover")]//div[contains(text(),"${expected_text}")]
END
Wait Until Page Contains Element
... xpath=//div[contains(@class,"popover")]//footer/button[text()="Event log"]

Page Should Contain Event Log
[Documentation] Checks if the event log is displayed
[Arguments] ${expected_progress_text}=${NONE} ${expected_result_text}=${NONE}
Is Generic Modal Displayed
Run Keyword And Continue On Failure Page Should Contain Starting server
Run Keyword And Continue On Failure Page Should Contain Event log
Run Keyword And Continue On Failure Page Should Contain Element css:ul[data-id="event-logs"]
${text}= Get Text css:ul[data-id="event-logs"]
IF "${expected_progress_text}" != "${NONE}"
Page Should Contain Element
... xpath=//div[@data-id="progress-bar"]//div[contains(text(),"${expected_progress_text}")]
END
IF "${expected_result_text}" != "${NONE}"
Page Should Contain Element
... xpath=//div[contains(@class,"alert")]//h4[contains(text(),"${expected_result_text}")]
END
Capture Page Screenshot
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ ${WORKBENCH_3_TITLE}= ODS-CI Workbench 3
${WORKBENCH_3_DESCRIPTION}= ODS-CI Workbench 3 is a test workbench using ${NB_IMAGE} image to test DS Projects feature
${WORKBENCH_4_TITLE}= ODS-CI Workbench 4 - envs
${WORKBENCH_4_DESCRIPTION}= ODS-CI Workbench 4 - envs is a test workbench
${WORKBENCH_5_TITLE}= ODS-CI Workbench 5 - XL
${WORKBENCH_5_DESCRIPTION}= ODS-CI Workbench 5 - XL is a test workbench
... using ${NB_IMAGE} image to test DS Projects feature
${WORKBENCH_6_TITLE}= ODS-CI Workbench 6 - event log
${WORKBENCH_6_DESCRIPTION}= ODS-CI Workbench 6 - event log is a test workbench
... using ${NB_IMAGE} image to test DS Projects feature
${PV_BASENAME}= ods-ci-pv
${PV_DESCRIPTION}= ods-ci-pv is a PV created to test DS Projects feature
# PV size are in GB
${PV_SIZE}= 2
${DC_S3_NAME}= ods-ci-s3
${DC_2_S3_NAME}= ods-ci-s3-connected
${DC_S3_AWS_SECRET_ACCESS_KEY}= custom dummy secret access key
${DC_S3_AWS_ACCESS_KEY}= custom dummy access key id
${DC_S3_ENDPOINT}= custom.endpoint.s3.com
Expand Down Expand Up @@ -221,6 +227,28 @@ Verify User Can Launch A Workbench
Check Launched Workbench Is The Correct One workbench_title=${WORKBENCH_2_TITLE}
... image=${NB_IMAGE} namespace=${ns_name}

Verify User Can Create A S3 Data Connection And Connect It To Workbenches
[Tags] Sanity Tier1
... ODS-1825 ODS-1972
[Documentation] Verifies users can add a Data connection to AWS S3
${ns_name}= Get Openshift Namespace From Data Science Project project_title=${PRJ_TITLE}
Open Data Science Project Details Page project_title=${PRJ_TITLE}
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}
... aws_s3_endpoint=${DC_S3_ENDPOINT} aws_region=${DC_S3_REGION}
Data Connection Should Be Listed name=${DC_S3_NAME} type=${DC_S3_TYPE} connected_workbench=${NONE}
Check Corresponding Data Connection Secret Exists dc_name=${DC_S3_NAME} namespace=${ns_name}
${workbenches}= Create List ${WORKBENCH_2_TITLE} ${WORKBENCH_3_TITLE}
Create S3 Data Connection project_title=${PRJ_TITLE} dc_name=${DC_2_S3_NAME}
... aws_access_key=${DC_S3_AWS_SECRET_ACCESS_KEY}
... aws_secret_access=${DC_S3_AWS_SECRET_ACCESS_KEY}
... aws_s3_endpoint=${DC_S3_ENDPOINT} aws_region=${DC_S3_REGION}
... connected_workbench=${workbenches}
Data Connection Should Be Listed name=${DC_2_S3_NAME} type=${DC_S3_TYPE} connected_workbench=${workbenches}
Run Keyword And Continue On Failure Wait Until Workbench Is Started workbench_title=${WORKBENCH_2_TITLE}
Workbench Status Should Be workbench_title=${WORKBENCH_3_TITLE} status=${WORKBENCH_STATUS_STOPPED}

Verify User Can Stop A Workbench From Projects Home Page
[Tags] Sanity Tier1 ODS-1823
[Documentation] Verifies users can stop a running workbench from Data Science Projects home page
Expand Down Expand Up @@ -269,18 +297,6 @@ Verify User Can Delete A Persistent Storage
Storage Should Not Be Listed name=${pv_name}
Check Storage PersistentVolumeClaim Is Deleted storage_name=${pv_name} namespace=${ns_name}

Verify User Can Add A S3 Data Connection
[Tags] Sanity Tier1 ODS-1825
[Documentation] Verifies users can add a Data connection to AWS S3
${ns_name}= Get Openshift Namespace From Data Science Project project_title=${PRJ_TITLE}
Open Data Science Project Details Page project_title=${PRJ_TITLE}
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}
... aws_s3_endpoint=${DC_S3_ENDPOINT} aws_region=${DC_S3_REGION}
Data Connection Should Be Listed name=${DC_S3_NAME} type=${DC_S3_TYPE} connected_workbench=${NONE}
Check Corresponding Data Connection Secret Exists dc_name=${DC_S3_NAME} namespace=${ns_name}

Verify User Can Delete A Data Connection
[Tags] Sanity Tier1 ODS-1826
[Documentation] Verifies users can delete a Data connection
Expand All @@ -294,6 +310,7 @@ Verify User Can Delete A Data Connection
Verify User Can Create A Workbench With Environment Variables
[Tags] Sanity Tier1 ODS-1864
[Documentation] Verifies users can create a workbench and inject environment variables during creation
# [Teardown] Delete Workbench workbench_title=${WORKBENCH_4_TITLE}
${pv_name}= Set Variable ${PV_BASENAME}-existent
${envs_var_secrets}= Create Dictionary secretA=TestVarA secretB=TestVarB
... k8s_type=Secret input_type=${KEYVALUE_TYPE}
Expand All @@ -310,6 +327,51 @@ Verify User Can Create A Workbench With Environment Variables
Launch Workbench workbench_title=${WORKBENCH_4_TITLE}
Check Environment Variables Exist exp_env_variables=${envs_list}

Verify Event Log Is Accessible While Starting A Workbench
[Tags] Tier1 Sanity
... ODS-1970
[Documentation] Verify user can access event log while starting a workbench
[Teardown] Delete Workbench workbench_title=${WORKBENCH_6_TITLE}
Open Data Science Project Details Page project_title=${PRJ_TITLE}
Create Workbench workbench_title=${WORKBENCH_6_TITLE} workbench_description=${WORKBENCH_6_DESCRIPTION}
... prj_title=${PRJ_TITLE} image_name=${NB_IMAGE} deployment_size=Small
... storage=Persistent pv_name=${NONE} pv_existent=${NONE}
... pv_description=${NONE} pv_size=${NONE}
... press_cancel=${FALSE} envs=${NONE}
Workbench Status Should Be workbench_title=${WORKBENCH_6_TITLE}
... status=${WORKBENCH_STATUS_STARTING}
Open Notebook Event Log workbench_title=${WORKBENCH_6_TITLE}
Page Should Contain Event Log
Wait Until Workbench Is Started workbench_title=${WORKBENCH_6_TITLE}
Page Should Contain Event Log expected_progress_text=Oauth proxy container started
... expected_result_text=Success
Close Event Log
Wait Until Project Is Open project_title=${PRJ_TITLE}

Verify Error Is Reported When Workbench Fails To Start # robocop: disable
[Tags] Tier1 Sanity
... ODS-1973
... AutomationBug
[Documentation] Verify UI informs users about workbenches failed to start.
... At the moment the test is considering only the scenario where
... the workbench fails for Insufficient resources.
[Teardown] Delete Workbench workbench_title=${WORKBENCH_5_TITLE}
Open Data Science Project Details Page project_title=${PRJ_TITLE}
Create Workbench workbench_title=${WORKBENCH_5_TITLE} workbench_description=${WORKBENCH_5_DESCRIPTION}
... prj_title=${PRJ_TITLE} image_name=${NB_IMAGE} deployment_size=X Large
... storage=Persistent pv_name=${NONE} pv_existent=${NONE}
... pv_description=${NONE} pv_size=${NONE}
... press_cancel=${FALSE} envs=${NONE}
Workbench Status Should Be workbench_title=${WORKBENCH_5_TITLE}
... status=${WORKBENCH_STATUS_STARTING}
Start Workbench Should Fail workbench_title=${WORKBENCH_5_TITLE}
Open Notebook Event Log workbench_title=${WORKBENCH_5_TITLE}
... exp_preview_text=Insufficient
Event Log Should Report The Failure exp_progress_text=Insufficient resources to start
... exp_result_text=FailedScheduling
Close Event Log
Wait Until Project Is Open project_title=${PRJ_TITLE}

Verify User Can Delete A Data Science Project
[Tags] Sanity Tier1 ODS-1784
[Documentation] Verifies users can delete a Data Science project
Expand Down

0 comments on commit cd70161

Please sign in to comment.