Skip to content

Commit

Permalink
Merge branch 'master' into feature/check_correct_component_images
Browse files Browse the repository at this point in the history
  • Loading branch information
asanzgom authored Oct 28, 2024
2 parents 776d880 + ab57afc commit 109e40f
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 181 deletions.
118 changes: 118 additions & 0 deletions ods_ci/tests/Resources/Page/Components/Components.resource
Original file line number Diff line number Diff line change
@@ -1,2 +1,120 @@
*** Settings ***
Resource Menu.robot
Resource ../../OCP.resource
Resource ../../ODS.robot


*** Keywords ***
Set DSC Component Removed State And Wait For Completion
[Documentation] Set component management state to 'Removed', and wait for deployment and pod to be removed.
[Arguments] ${component} ${deployment_name} ${label_selector}

${management_state}= Get DSC Component State ${DSC_NAME} ${component} ${OPERATOR_NS}
IF "${management_state}" != "Removed"
Set Component State ${component} Removed
END

Wait For Resources To Be Removed ${deployment_name} ${label_selector}

Set DSC Component Managed State And Wait For Completion
[Documentation] Set component management state to 'Managed', and wait for deployment and pod to be available.
[Arguments] ${component} ${deployment_name} ${label_selector}

${management_state}= Get DSC Component State ${DSC_NAME} ${component} ${OPERATOR_NS}
IF "${management_state}" != "Managed"
Set Component State ${component} Managed
END

Wait For Resources To Be Available ${deployment_name} ${label_selector}

Check Image Pull Path Is Redhatio ${deployment_name}

Wait For Resources To Be Available
[Documentation] Wait until Deployment and Pod(s) are Available
[Arguments] ${deployment_name} ${label_selector}
Wait Until Keyword Succeeds 5 min 0 sec
... Is Resource Present Deployment ${deployment_name} ${APPLICATIONS_NS} ${IS_PRESENT}

Wait Until Keyword Succeeds 5 min 0 sec
... Check If Pod Exists ${APPLICATIONS_NS} ${label_selector} ${FALSE}

Wait Until Keyword Succeeds 8 min 0 sec
... Is Pod Ready ${label_selector}

Wait For Resources To Be Removed
[Documentation] Wait until Deployment and Pod(s) to Removed
[Arguments] ${deployment_name} ${label_selector}

Wait Until Keyword Succeeds 5 min 0 sec
... Is Resource Present Deployment ${deployment_name} ${APPLICATIONS_NS} ${IS_NOT_PRESENT}

Wait Until Keyword Succeeds 5 min 0 sec
... Check If Pod Does Not Exist ${label_selector} ${APPLICATIONS_NS}

Restore DSC Component State
[Documentation] Set component management state to original state, wait for component resources to be available.
[Arguments] ${component} ${deployment_name} ${LABEL_SELECTOR} ${saved_state}

${current_state}= Get DSC Component State ${DSC_NAME} ${component} ${OPERATOR_NS}
IF "${current_state}" != "${saved_state}"
IF "${saved_state}" == "Managed"
Set DSC Component Managed State And Wait For Completion ${component} ${deployment_name} ${LABEL_SELECTOR}
ELSE IF "${saved_state}" == "Removed"
Set DSC Component Removed State And Wait For Completion ${component} ${deployment_name} ${LABEL_SELECTOR}
ELSE
FAIL Component ${component} state "${saved_state}" not supported at this time
END
END

Is Pod Ready
[Documentation] Check If Pod Is In Ready State.
... Note: Will check that all pods with given label-selector are in Ready state.
[Arguments] ${label_selector}
${rc} ${output}= Run And Return Rc And Output
... oc get pod -A -l ${label_selector} -o jsonpath='{..status.conditions[?(@.type=="Ready")].status}'
# Log To Console "Pod Ready Status: ${output}"
Should Be Equal As Integers ${rc} 0
Should Not Contain ${output} False

Get DataScienceCluster Spec
[Documentation] Return the DSC Spec
[Arguments] ${DSC_NAME}
${rc} ${output}= Run And Return Rc And Output
... oc get DataScienceCluster/${DSC_NAME} -n ${OPERATOR_NS} -o "jsonpath={".spec"}"
Should Be Equal As Integers ${rc} 0
RETURN ${output}

Check Image Pull Path Is Redhatio
[Documentation] Check that the Deployment Image Pull Path is registry.redhat.io
[Arguments] ${deployment_name}

# Skip pull path check if Deployment is in exclusion list
IF $deployment_name in @{REDHATIO_PATH_CHECK_EXCLUSTION_LIST}
Log To Console Skip image pull path check for Deployment ${deployment_name}
RETURN
END

${rc} ${image}= Run And Return Rc And Output
... oc get deployment/${deployment_name} -n ${APPLICATIONS_NAMESPACE} -o jsonpath="{..image}"
Should Be Equal As Integers ${rc} 0 msg=${image}

Log To Console Check deployment ${deployment_name} pull path for image ${image}
IF "registry.redhat.io" in $image
Log To Console Deployment ${deployment_name} image contains pull path registry.redhat.io
ELSE
Fail Deployment image ${deployment_name} does not contain pull path registry.redhat.io
END

Check Model Registry Namespace
[Documentation] Check that DSC modelregistry.registriesNamespace is correct for ODH/RHOAI
... Validate that namespace exists.
${rc} ${namespace}= Run And Return Rc And Output
... oc get DataScienceCluster/${DSC_NAME} -n ${OPERATOR_NS} -o "jsonpath={".spec.components.modelregistry.registriesNamespace"}"
Should Be Equal As Integers ${rc} 0 msg=${namespace}

Should Be Equal ${namespace} ${MODEL_REGISTRY_NAMESPACE} msg=Model Registry Namespace: Actual "${namespace}" Expected: "${MODEL_REGISTRY_NAMESPACE}"

${rc} ${output}= Run And Return Rc And Output
... oc get namespace -A ${MODEL_REGISTRY_NAMESPACE}
Should Be Equal As Integers ${rc} 0 msg=${output}
41 changes: 41 additions & 0 deletions ods_ci/tests/Resources/Page/ModelRegistry/ModelRegistry.resource
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,13 @@ Model Registry Post Upgrade Scenario
Set Library Search Order SeleniumLibrary
RHOSi Setup
Component Should Be Enabled modelregistry
# Check for bug RHOAIENG-15033, will fail in 2.15
${operator_rest}= Get Model Registry Operator REST Image
${operator_grpc}= Get Model Registry Operator GRPC Image
${instance_rest}= Get Model Registry Instance rest Image
${instance_grpc}= Get Model Registry Instance grpc Image
Should Be Equal As Strings ${operator_rest} ${instance_rest}
Should Be Equal As Strings ${operator_grpc} ${instance_grpc}
Launch Dashboard ${TEST_USER.USERNAME} ${TEST_USER.PASSWORD} ${TEST_USER.AUTH_TYPE}
... ${ODH_DASHBOARD_URL} ${BROWSER.NAME} ${BROWSER.OPTIONS}
Open Model Registry Dashboard Page
Expand Down Expand Up @@ -404,3 +411,37 @@ Post Upgrade Scenario Teardown
Remove Deployment Files ${MODELREGISTRY_BASE_FOLDER}/Python_Dependencies
Disable Model Registry If Needed
RHOSi Teardown

Get Model Registry Operator Pod
[Documentation] Returns the name of the operator pod for model registry
${rc} ${name} = Run And Return Rc And Output
... oc get pod -l component.opendatahub.io/name=model-registry-operator -n ${APPLICATIONS_NAMESPACE} -o yaml | yq '.items[0].metadata.name'
Should Be Equal As Integers ${rc} 0
RETURN ${name}

Get Model Registry Operator ${type} Image
[Documentation] Returns the GRPC image defined in the operator, type should be either GRPC or REST (case
... sensitive)
IF "${type}"!="GRPC" and "${type}"!="REST"
Log To Console "Failing, `type` should be either REST or GRPC"
Fail
END
${pod_name}= Get Model Registry Operator Pod
${rc} ${img}= Run And Return RC And Output
... oc get pod ${pod_name} -o yaml -n ${APPLICATIONS_NAMESPACE} | yq '.spec.containers[0].env[] | select(.name == "${type}_IMAGE").value'
Should Be Equal As Integers ${rc} 0
RETURN ${img}

Get Model Registry Instance ${type} Image
[Documentation] Returns the GRPC/REST image defined in a MR instance, type should be either grpc or rest (case
... sensitive)
[Arguments] ${instance_name}=modelregistry-sample
${ns}= Get Model Registry Namespace From DSC
IF "${type}"!="grpc" and "${type}"!="rest"
Log To Console "Failing, `type` should be either rest or grpc"
Fail
END
${rc} ${img}= Run And Return RC And Output
... oc get pod -l app=${instance_name} -n ${ns} -o yaml | yq '.items[].spec.containers[] | select(.name=="${type}-container").image'
Should Be Equal As Integers ${rc} 0
RETURN ${img}
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,15 @@ Add And Run JupyterLab Code Cell 5 In Active Notebook
# This keyword was copied and amended from JupyterLibrary resources - Notebook.Add And Run JupyterLab Code Cell.

${add icon} = Get JupyterLab Icon XPath Custom add

${nb} = Get WebElement xpath://div${JLAB XP NB FRAG}\[${n}]
${nbid} = Get Element Attribute ${nb} id

${active-nb-tab} = Get WebElement xpath:${JL_TABBAR_SELECTED_XPATH}
${tab-id} = Get Element Attribute ${active-nb-tab} id

Click Element xpath://div[@aria-labelledby="${tab-id}"]/div[1]//${add icon}
Click Element xpath://div[@aria-labelledby="${tab-id}"]//*[@data-jp-item-name="insert"]
Sleep 0.1s
Click Element xpath://div[@aria-labelledby="${tab-id}"]//div[contains(concat(' ',normalize-space(@class),' '),' jp-mod-selected ')]
Set CodeMirror Value \#${nbid}${JLAB CSS ACTIVE INPUT} @{code}
Run Current JupyterLab Code Cell 5 ${tab-id}
Press Keys None @{code}
Click Element xpath://div[@aria-labelledby="${tab-id}"]//*[@data-jp-item-name="run"]
Click Element xpath://div[@aria-labelledby="${tab-id}"]//div[contains(concat(' ',normalize-space(@class),' '),' jp-mod-selected ')]

Add And Run JupyterLab Code Cell 6 In Active Notebook
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Wait For RHODS Dashboard To Load
IF "${expected_page}" == "${NONE}"
Wait Until Page Contains Element //div[@data-testid="home-page"] timeout=${timeout}
ELSE
Menu.Navigate To Page ${expected_page}
Wait Until Keyword Succeeds 3x 5s
... Wait For Dashboard Page Title ${expected_page} timeout=${timeout}
END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ ${ACTIONS_BTN_XP}= xpath=//div/button[@aria-label="Actions"]
${DELETE_ACTION_BTN_XP}= xpath=//div/ul/li/button[text()="Delete project"]
${EDIT_ACTION_BTN_XP}= xpath=//div/ul/li/button[text()="Edit project"]
${SPAWNER_LINK}= xpath=//*[text()="Launch standalone notebook server"]
${PROJECT_SEARCH_BAR}= //div[@data-testid="dashboard-table-toolbar"]
${PROJECT_FILTER_TYPE}= ${PROJECT_SEARCH_BAR}//button[@data-testid="filter-dropdown-select"]
${PROJECT_SEARCH_INPUT}= ${PROJECT_SEARCH_BAR}//input[@aria-label="Search input"]
${PROJECT_SEARCH_BAR}= [data-testid="projects-table-toolbar"]
${PROJECT_FILTER_TYPE}= ${PROJECT_SEARCH_BAR} [data-testid="filter-toolbar-dropdown"]
${PROJECT_SEARCH_INPUT}= ${PROJECT_SEARCH_BAR} [data-testid="filter-toolbar-text-field"] input

*** Keywords ***
Open Data Science Projects Home Page
[Documentation] Open "Data Science Projects" page from the sidebar
Wait Until Page Contains Data Science Projects
Click Link Data Science Projects
Wait For RHODS Dashboard To Load wait_for_cards=${FALSE} expected_page=Data Science Projects
Wait Until Page Contains View your existing projects or create new projects. timeout=30
Maybe Wait For Dashboard Loading Spinner Page

Is Data Science Projects Page Open
Expand Down Expand Up @@ -314,7 +311,7 @@ Start Workbench From Projects Home Page
${kebab_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible ${kebab_button} timeout=10s
Click Element ${kebab_button}
${start_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]/following::div//span[text()="Start"]
${start_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@data-testid="notebook-start-action"]
Wait Until Element Is Visible ${start_button} timeout=10s
Click Element ${start_button}
ELSE
Expand Down Expand Up @@ -348,7 +345,7 @@ Stop Workbench From Projects Home Page
${kebab_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible ${kebab_button} timeout=10s
Click Element ${kebab_button}
${stop_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]/following::div//span[text()="Stop"]
${stop_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@data-testid="notebook-stop-action"]
Wait Until Element Is Visible ${stop_button} timeout=10s
Click Element ${stop_button}
Handle Stop Workbench Confirmation Modal press_cancel=${press_cancel}
Expand Down Expand Up @@ -430,13 +427,12 @@ Remove Current Page Projects From All Projects
Filter Projects By ${Type}
[Documentation] Search for projects where ${Type} includes "${text}"
[Arguments] ${text}
Open Data Science Projects Home Page
${searchbar_exists}= Run Keyword And Return Status
... Page Should Contain Element xpath:${PROJECT_SEARCH_BAR}
... Page Should Contain Element css:${PROJECT_SEARCH_BAR}
IF ${searchbar_exists}
Click Element xpath:${PROJECT_FILTER_TYPE}
Click Element xpath:${PROJECT_SEARCH_BAR}//li[@data-testid="${Type}"]
Input Text ${PROJECT_SEARCH_INPUT} ${text}
Click Element css:${PROJECT_FILTER_TYPE}
Click Element css:${PROJECT_SEARCH_BAR} [id="${Type}"]
Input Text css:${PROJECT_SEARCH_INPUT} ${text}
ELSE
Log No projects are listed
END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Create Workbench
Input Text ${WORKBENCH_NAME_INPUT_XP} ${workbench_title}
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} version=${version}
Select Workbench Image image_name=${image_name} version=${version}
IF "${deployment_size}" != "${NONE}" Select Workbench Container Size size_name=${deployment_size}
IF "${gpus}" != "${NONE}" Select Workbench Number Of GPUs gpus=${gpus}
IF "${envs}" != "${NONE}"
Expand Down Expand Up @@ -197,7 +197,7 @@ Select An Existent PV
Wait Until Page Contains Element ${existing_pv_xpath}
Click Element ${existing_pv_xpath}

Select Workbench Jupyter Image
Select Workbench Image
[Documentation] Selects a Jupyter image in the workbench creation page
[Arguments] ${image_name} ${version}=default
IF "${PRODUCT}" == "ODH"
Expand All @@ -206,7 +206,6 @@ Select Workbench Jupyter Image
${image_name}= Set Variable Jupyter Data Science
END
END

Click Element //a[@href="#notebook-image"]
Wait Until Page Contains Element ${WORKBENCH_IMAGE_MENU_BTN_XP}
Click Element ${WORKBENCH_IMAGE_MENU_BTN_XP}
Expand All @@ -221,15 +220,15 @@ Select Workbench Jupyter Image
Fail ${version} does not exist, use default/previous
END
END

IF "${version}"=="previous"
# Let's reset the JupyterLibrary settings so that global variables for Jupyter 3 (default) are in place.
Update Globals For JupyterLab 3 Custom
ELSE
# TODO: Create the missing Keyword "Update Globals For JupyterLab 4"
# ELSE
# For Jupyter 4, we need to update global default variable values (images 2024b and newer)
# This calls method from JupyterLibrary Version.resource module
# https://github.com/robots-from-jupyter/robotframework-jupyterlibrary/blob/9e25fcb89a5f1a723c59e9b96706e4c638e0d9be/src/JupyterLibrary/clients/jupyterlab/Version.resource
Update Globals For JupyterLab 4
# Update Globals For JupyterLab 4
END

Verify Version Selection Dropdown
Expand Down Expand Up @@ -446,7 +445,7 @@ Edit Workbench
# Also wait until the workbench name is populated in the text field - let's wait for DOM to finish
Wait For Condition return document.readyState == "complete" timeout=5s

Check Launched Workbench Is The Correct One
Verify Workbench Image In Jupyter Lab
[Documentation] Checks if the launched workbench is the expected one
[Arguments] ${workbench_title} ${image} ${project_title}
${namespace}= Get Openshift Namespace From Data Science Project project_title=${project_title}
Expand Down
Loading

0 comments on commit 109e40f

Please sign in to comment.