diff --git a/ods_ci/tests/Resources/CLI/AcceleratorProfiles/AcceleratorProfiles.resource b/ods_ci/tests/Resources/CLI/AcceleratorProfiles/AcceleratorProfiles.resource new file mode 100644 index 000000000..939142a2c --- /dev/null +++ b/ods_ci/tests/Resources/CLI/AcceleratorProfiles/AcceleratorProfiles.resource @@ -0,0 +1,100 @@ +*** Settings *** +Documentation Collection of keywords to interact with the administration of Accelerator Profiles via CLI + + +*** Variables *** +${ACCELERATOR_RESOURCES_DIRPATH}= ods_ci/tests/Resources/Files/accelerator + + +*** Keywords *** +Create An Accelerator Profile Via CLI + [Documentation] Create an instance of Accelerator Profile using OC + [Arguments] ${name} ${ns}=${APPLICATIONS_NAMESPACE} + ${status}= Run Keyword And Return Status Oc Create kind=AcceleratorProfile + ... src=${ACCELERATOR_RESOURCES_DIRPATH}/${name}.yaml namespace=${ns} + ... template_data={test_name: '${TEST_NAME}', test_ns: '${ns}'} + Should Be Equal As Integers ${status} ${TRUE} + +Get Accelerator Profile Spec Values Via CLI + [Documentation] Get Spec fields from an specific Accelerator Profile Instance + [Arguments] ${display_name} ${ns}=${APPLICATIONS_NAMESPACE} + ${ap_from_oc}= Run + ... oc get acceleratorprofile -n ${ns} -o json | jq '.items[] | select(.spec.displayName == "${display_name}")' + ${ap_json}= Load Json String ${ap_from_oc} + ${ap_spec_dict}= Get From Dictionary ${ap_json} spec + RETURN ${ap_spec_dict} + +Accelerator Profile Should Not Exist + [Documentation] Get Spec fields from an specific Accelerator Profile Instance + [Arguments] ${name} ${ns}=${APPLICATIONS_NAMESPACE} + ${rc} ${out}= Run And Return Rc And Output oc get acceleratorprofile ${name} -n ${ns} + Should Be Equal "${rc}" "1" + Should Contain ${out} "${name}" not found + +Verify Accelerator Profile Values Via CLI + [Documentation] Verifies that an specific Accelerator Profile exists, and it's value match with the expected + [Arguments] ${name} ${identifier}=${EMPTY} ${description}=${EMPTY} ${enabled}=True + ... ${tolerations}=${EMPTY} ${tol_operator}=Equal ${tol_effect}=None ${tol_key}=key + ... ${tol_value}=value ${tol_seconds}=Forever ${ns}=${APPLICATIONS_NAMESPACE} + ${ap_spec_dict}= Get Accelerator Profile Spec Values Via CLI ${name} ${ns} + ${name_from_spec}= Get From Dictionary ${ap_spec_dict} displayName + ${enabled_from_spec}= Get From Dictionary ${ap_spec_dict} enabled + ${bool_enabled}= Convert To Boolean ${enabled} + Should Be Equal ${name_from_spec} ${name} + Should Be Equal ${enabled_from_spec} ${bool_enabled} + # Identifier + IF "${identifier}" != "${EMPTY}" + ${identifier_from_spec}= Get From Dictionary ${ap_spec_dict} identifier + Should Be Equal ${identifier_from_spec} ${identifier} + END + # Description + IF "${description}" != "${EMPTY}" + ${description_from_spec}= Get From Dictionary ${ap_spec_dict} description + Should Be Equal ${description_from_spec} ${description} + END + # Tolerations + IF "${tolerations}" != "${EMPTY}" + ${tolerations_from_spec}= Get From Dictionary ${ap_spec_dict} tolerations + ${tol_operator_retrieved}= Get From Dictionary ${tolerations_from_spec}[0] operator + Should Be Equal ${tol_operator_retrieved} ${tol_operator} + ${tol_key_retrieved}= Get From Dictionary ${tolerations_from_spec}[0] key + Should Be Equal ${tol_key_retrieved} ${tol_key} + ${tol_value_retrieved}= Get From Dictionary ${tolerations_from_spec}[0] value + Should Be Equal ${tol_value_retrieved} ${tol_value} + # Effect + ${tol_effect_retrieved}= Get From Dictionary ${tolerations_from_spec}[0] effect + IF "${tol_effect}" == "None" + Should Be Equal ${tol_effect_retrieved} "" + ELSE + Should Be Equal ${tol_effect_retrieved} ${tol_effect} + END + # Toleration Seconds + IF "${tol_seconds}" != "Forever" + ${tol_seconds_retrieved}= Get From Dictionary ${tolerations_from_spec}[0] tolerationSeconds + Should Be Equal "${tol_seconds_retrieved}" "${tol_seconds}" + END + END + +Verify Accelerator Profile Has No Tolerations Via CLI + [Documentation] Verifies that an specific Accelerator Profile exists, and it has no tolerations + [Arguments] ${name} ${ns}=${APPLICATIONS_NAMESPACE} + ${ap_spec_dict}= Get Accelerator Profile Spec Values Via CLI ${name} ${ns} + ${tolerations_from_spec}= Get From Dictionary ${ap_spec_dict} tolerations + Should Be Empty ${tolerations_from_spec} + +Delete All Accelerator Profiles Which Starts With + [Documentation] Delete all accelerator profiles given prefix. That prefix should match with the metadata.name + ... value of the OC Accelerator Profile resource + ... Uses OC + [Arguments] ${ap_prefix} ${ns}=${APPLICATIONS_NAMESPACE} + ${ap_str}= Run + ... oc get acceleratorprofiles -n ${ns} -o json | jq .items[].metadata.name | grep ${ap_prefix} | tr -d '"' + @{ap_list}= Split String ${ap_str} separator=\n + Log List of Accelerator Profiles to be deleted: @{ap_list} console=yes + FOR ${ap_name} IN @{ap_list} + ${ap_desc}= Run oc get acceleratorprofile ${ap_name} -n ${ns} -o json + Log ${ap_desc} console=yes + ${return_code}= Run And Return Rc + ... oc delete acceleratorprofile ${ap_name} -n ${ns} + Should Be Equal As Integers ${return_code} 0 msg=Error deleting Accelerator profile ${ap_name} + END diff --git a/ods_ci/tests/Resources/Common.robot b/ods_ci/tests/Resources/Common.robot index 6a4007f2d..0cbedf64b 100644 --- a/ods_ci/tests/Resources/Common.robot +++ b/ods_ci/tests/Resources/Common.robot @@ -489,3 +489,10 @@ Configure User Workload Monitoring ${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 + +Clear Element And Input Text + [Documentation] Clear and input text element, wait .5 seconds and input new text on it + [Arguments] ${element_xpath} ${new_text} + Clear Element Text ${element_xpath} + Sleep 0.5s + Input Text ${element_xpath} ${new_text} diff --git a/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-2.yaml b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-2.yaml new file mode 100644 index 000000000..0623ea8cd --- /dev/null +++ b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-2.yaml @@ -0,0 +1,17 @@ +# File to provision an Accelerator Profile instance in test: +# "Modify An Accelerator Profile Using "Accelerator Profiles" Administration UI" +apiVersion: dashboard.opendatahub.io/v1 +kind: AcceleratorProfile +metadata: + name: accelerator-profile-3349-2 + namespace: {{ test_ns }} +spec: + description: {{ test_name }} + displayName: "Test: Modify Accelerator Profile 2" + enabled: true + identifier: identifier/identifier + tolerations: + - effect: NoSchedule + key: key + operator: Exists + value: value diff --git a/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-3.yaml b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-3.yaml new file mode 100644 index 000000000..720d58545 --- /dev/null +++ b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-3.yaml @@ -0,0 +1,17 @@ +# File to provision an Accelerator Profile instance in test: +# "Delete Tolerations from an Accelerator Profile Using "Accelerator Profiles" Administration UI" +apiVersion: dashboard.opendatahub.io/v1 +kind: AcceleratorProfile +metadata: + name: accelerator-profile-3349-3 + namespace: {{ test_ns }} +spec: + displayName: "Test: Delete Tolerations from AP 3" + description: {{ test_name }} + enabled: true + identifier: nvidia.com/gpu + tolerations: + - effect: NoSchedule + key: key + operator: Exists + value: value diff --git a/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-4.yaml b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-4.yaml new file mode 100644 index 000000000..c65ffdd07 --- /dev/null +++ b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-4.yaml @@ -0,0 +1,18 @@ +# File to provision an Accelerator Profile instance in test: +# "Disable an Accelerator Profile From The Accelerator Profile Edit View" +apiVersion: dashboard.opendatahub.io/v1 +kind: AcceleratorProfile +metadata: + generation: 1 + name: accelerator-profile-3349-4 + namespace: {{ test_ns }} +spec: + displayName: "Test: Disable AP 4 from Edit Detail View" + description: {{ test_name }} + enabled: true + identifier: nvidia.com/gpu + tolerations: + - effect: NoSchedule + key: key + operator: Exists + value: value diff --git a/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-5.yaml b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-5.yaml new file mode 100644 index 000000000..1840301ea --- /dev/null +++ b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-5.yaml @@ -0,0 +1,13 @@ +# File to provision an Accelerator Profile instance in test: +# "Enable an Accelerator Profile From The Accelerator Profile Edit View" +apiVersion: dashboard.opendatahub.io/v1 +kind: AcceleratorProfile +metadata: + generation: 1 + name: accelerator-profile-3349-5 + namespace: {{ test_ns }} +spec: + displayName: "Test: Enable AP 5 from Edit Detail View" + description: {{ test_name }} + enabled: false + identifier: nvidia.com/gpu diff --git a/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-6.yaml b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-6.yaml new file mode 100644 index 000000000..daef7d79e --- /dev/null +++ b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-6.yaml @@ -0,0 +1,18 @@ +# File to provision an Accelerator Profile instance in test: +# "Disable an Accelerator Profile From The Grid of the Accelerator Profile View" +apiVersion: dashboard.opendatahub.io/v1 +kind: AcceleratorProfile +metadata: + generation: 1 + name: accelerator-profile-3349-6 + namespace: {{ test_ns }} +spec: + displayName: "Test: Disable AP 6 from Administration View" + description: {{ test_name }} + enabled: true + identifier: nvidia.com/gpu + tolerations: + - effect: NoSchedule + key: key + operator: Exists + value: value diff --git a/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-7.yaml b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-7.yaml new file mode 100644 index 000000000..e45f80bec --- /dev/null +++ b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-7.yaml @@ -0,0 +1,18 @@ +# File to provision an Accelerator Profile instance in test: +# "Enable an Accelerator Profile From The Grid of the Accelerator Profile View" +apiVersion: dashboard.opendatahub.io/v1 +kind: AcceleratorProfile +metadata: + generation: 1 + name: accelerator-profile-3349-7 + namespace: {{ test_ns }} +spec: + displayName: "Test: Enable AP 7 from Administration View" + description: {{ test_name }} + enabled: false + identifier: nvidia.com/gpu + tolerations: + - effect: NoSchedule + key: key + operator: Exists + value: value diff --git a/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-8.yaml b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-8.yaml new file mode 100644 index 000000000..3a0fb0f66 --- /dev/null +++ b/ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-8.yaml @@ -0,0 +1,12 @@ +# File to provision an Accelerator Profile instance in test: +# "Delete an Accelerator Profile From The Grid of the Accelerator Profile View" +apiVersion: dashboard.opendatahub.io/v1 +kind: AcceleratorProfile +metadata: + generation: 1 + name: accelerator-profile-3349-8 + namespace: {{ test_ns }} +spec: + displayName: "Test: Delete AP 8 from grid" + enabled: false + identifier: nvidia.com/gpu diff --git a/ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.resource b/ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.resource index f819dede5..edf6bd2fa 100644 --- a/ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.resource +++ b/ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.resource @@ -1,5 +1,6 @@ *** Settings *** Resource ODHDashboard.robot +Resource ../../LoginPage.robot Library RequestsLibrary Library SeleniumLibrary @@ -9,3 +10,15 @@ ${SELF_BADGE_TITLE}= Self-managed ${RH_BADGE_TITLE}= Red Hat managed ${CMS_BADGE_TITLE}= Coming soon ${BETA_BADGE_TITLE}= Beta + + +*** Keywords *** +Open ODS Dashboard With Admin User + [Documentation] Opens a browser and logs into ODS Dashboard with a user belonging to the rhods-admins group + Launch Dashboard ${TEST_USER.USERNAME} ${TEST_USER.PASSWORD} ${TEST_USER.AUTH_TYPE} + ... ${ODH_DASHBOARD_URL} browser=${BROWSER.NAME} browser_options=${BROWSER.OPTIONS} + +Open ODS Dashboard With Non Admin User + [Documentation] Opens a browser and logs into ODS Dashboard with a user belonging to the rhods-users group + Launch Dashboard ${TEST_USER_3.USERNAME} ${TEST_USER_3.PASSWORD} ${TEST_USER_3.AUTH_TYPE} + ... ${ODH_DASHBOARD_URL} browser=${BROWSER.NAME} browser_options=${BROWSER.OPTIONS} diff --git a/ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboardSettingsAcceleratorProfiles.resource b/ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboardSettingsAcceleratorProfiles.resource new file mode 100644 index 000000000..7608bf264 --- /dev/null +++ b/ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDashboardSettingsAcceleratorProfiles.resource @@ -0,0 +1,203 @@ +*** Settings *** +Documentation Collection of keywords to interact with the administration of Accelerator Profiles +Resource ../../../Common.robot + + +*** Variables *** +${CREATE_ACCELERATOR_PROFILE_EMPTY_LIST_BTN}= //button[@data-id="display-accelerator-modal-button"] +${CREATE_ACCELERATOR_PROFILE_BTN}= //button[@data-testid="create-accelerator-profile"] +${EDIT_ACCELERATOR_PROFILE_BTN}= //table[@id='accelerator-profile-table']//span[text()='Edit']/ancestor::button +${DELETE_ACCELERATOR_PROFILE_BTN}= //table[@id='accelerator-profile-table']//span[text()='Delete']/ancestor::button +${ACCELERATOR_PROFILE_GRID_COLUMN_NAME}= //table[@id='accelerator-profile-table']//td[@data-label='Name'] +${ACCELERATOR_PROFILE_SEARCH_INPUT}= //input[@aria-label="Search input"] +${ACCELERATOR_NAME}= //input[@id="accelerator-name"] +${ACCELERATOR_IDENTIFIER}= //input[@id="accelerator-identifier"] +${ACCELERATOR_DESCRIPTION}= //textarea[@id="accelerator-description"] +${ACCELERATOR_ENABLED_SWITCH}= //input[@id="accelerator-enabled"]/following-sibling::span +${ACCELERATOR_ADD_TOLERATION_BTN}= //button[@data-testid="add-toleration-button"] +${ACCELERATOR_ADD_TOLERATION_MODAL_FORM}= //div[contains(@id, "pf-modal-part")]//span[text()="Add toleration"] +${ACCELERATOR_TOLERATION_OPERATOR_DROPDOWN}= //div[@data-testid="toleration-operator-select"]/button +${CREATE_OR_UPDATE_ACCELERATOR_PROFILE_DETAIL_BTN}= //button[@id="create-button"] +${ACCELERATOR_TOLERATION_EFFECT_DROPDOWN}= //label[@for="effect-select"]/parent::*/following::*[1]//button +${ACCELERATOR_TOLERATION_KEY}= //input[@id='toleration-key'] +${ACCELERATOR_TOLERATION_VALUE}= //input[@id='toleration-value'] +${ACCELERATOR_TOLERATION_SECONDS_FOREVER_RADIO}= //input[@id="forever"] +${ACCELERATOR_TOLERATION_SECONDS_CUSTOM_RADIO}= //input[@id="custom-value"] +${ACCELERATOR_TOLERATION_SECONDS_CUSTOM_VALUE}= //div[contains(@class, 'number-input')]//input +${ACCELERATOR_TOLERATION_ADD_OR_UPDATE_BUTTON}= //button[@data-testid="modal-submit-button"] +${ACCELERATOR_EDIT_NAV_MENU_TOLERATIONS}= //nav[@aria-label="Jump to section"]//span[text()="Tolerations"] +${ACCELERATOR_EDIT_TOLERATION_KEBAB_BTN}= //section[@aria-label="Tolerations"]//table//button[@aria-label="Kebab toggle"] +${ACCELERATOR_EDIT_TOLERATION_MODAL_FORM}= //div[contains(@id, "pf-modal-part")]//span[text()="Edit toleration"] +${ACCELERATOR_DISABLE_MODAL_DISABLE_BUTTON}= //span[text()='Disable accelerator profile']/ancestor::header/following::footer/button[text()='Disable'] +${ACCELERATOR_DELETE_MODAL_DELETE_BUTTON}= //span[text()='Delete accelerator profile?']/ancestor::header/following::footer/button[text()='Delete'] +${ACCELERATOR_DELETE_MODAL_INPUT}= //input[@id="delete-modal-input"] + + +*** Keywords *** +Click On Create Accelerator Profile Button + [Documentation] Click on the "Add new accelerator profile" (when there is none) or + ... the "Create accelerator profile" (when there is at least 1 + ... previously created). + ... view: Settings -> Accelerator profiles + ${empty_list}= Run Keyword And Return Status Wait Until Page Contains Element + ... ${CREATE_ACCELERATOR_PROFILE_EMPTY_LIST_BTN} timeout=5s + IF ${empty_list}==True + Click Button ${CREATE_ACCELERATOR_PROFILE_EMPTY_LIST_BTN} + ELSE + Click Button ${CREATE_ACCELERATOR_PROFILE_BTN} + END + +Click On Edit Accelerator Profile + [Documentation] Click on the the 3 dots button and then on the "Edit" button of an specific Accelerator Profile + ... from the grid + ... view: Settings -> Accelerator profiles + [Arguments] ${name} + Search For Accelerator Profile In Grid ${name} + ODHDashboard.Click Action From Actions Menu ${name} action=Edit + +Click On The Enable Switch From Accelerator Profile + [Documentation] Click on the the Enable switch from an specific Accelerator Profile + ... view: Settings -> Accelerator profiles + [Arguments] ${name} + Wait Until Page Contains Element //input[@id='${name}-enable-switch']/following-sibling::span + Click Element //input[@id='${name}-enable-switch']/following-sibling::span + +Disable Accelerator Profile + [Documentation] Disable an specific Accelerator Profile from the Grid + ... view: Settings -> Accelerator profiles + [Arguments] ${name} + Click On The Enable Switch From Accelerator Profile ${name} + Wait Until Page Contains Element ${ACCELERATOR_DISABLE_MODAL_DISABLE_BUTTON} + Click Button ${ACCELERATOR_DISABLE_MODAL_DISABLE_BUTTON} + +Search For Accelerator Profile In Grid + [Documentation] Search for and specific Accelerator Profile in the grid + ... view: Settings -> Accelerator profiles + [Arguments] ${name} + Wait Until Page Contains Element ${ACCELERATOR_PROFILE_SEARCH_INPUT} + Click Element ${ACCELERATOR_PROFILE_SEARCH_INPUT} + Clear Element And Input Text ${ACCELERATOR_PROFILE_SEARCH_INPUT} ${name} + +Delete Accelerator Profile + [Documentation] Delete an specific Accelerator Profile from the Grid + ... view: Settings -> Accelerator profiles + [Arguments] ${name} + Search For Accelerator Profile In Grid ${name} + ODHDashboard.Click Action From Actions Menu ${name} action=Delete + ODHDashboard.Handle Deletion Confirmation Modal ${name} item_type=accelerator profile + +Create An Accelerator Profile Via UI + [Documentation] Fill Accelerator Profile values with the ones provided in the arguments and click on + ... create button + ... view: Create Accelerator profile + [Arguments] ${name} ${identifier} ${description}=${EMPTY} ${enabled}=True + ... ${tolerations}=${EMPTY} ${tol_operator}=Equal ${tol_effect}=None ${tol_key}=key + ... ${tol_value}=value ${tol_seconds}=Forever + Click On Create Accelerator Profile Button + Wait Until Page Contains Element ${ACCELERATOR_NAME} timeout=5s + Input Text ${ACCELERATOR_NAME} ${name} + Input Text ${ACCELERATOR_IDENTIFIER} ${identifier} + IF "${description}" != "${EMPTY}" + Input Text ${ACCELERATOR_DESCRIPTION} ${description} + END + # By default are enabled + IF ${enabled} != True Click Element ${ACCELERATOR_ENABLED_SWITCH} + # Tolerations + IF "${tolerations}" != "${EMPTY}" + Click Button ${ACCELERATOR_ADD_TOLERATION_BTN} + Wait Until Element Is Visible ${ACCELERATOR_ADD_TOLERATION_MODAL_FORM} + # Select Operator + Click Button ${ACCELERATOR_TOLERATION_OPERATOR_DROPDOWN} + Click Element //div[@data-testid="toleration-operator-select"]//div[text()="${tol_operator}"] + # Select Effect + Click Button ${ACCELERATOR_TOLERATION_EFFECT_DROPDOWN} + Click Element //label[@for="effect-select"]/parent::*/following::div//*[text()="${tol_effect}"] + # Input Key and value + Input Text ${ACCELERATOR_TOLERATION_KEY} ${tol_key} + Input Text ${ACCELERATOR_TOLERATION_VALUE} ${tol_value} + # Toleration Seconds + IF "${tol_seconds}" != "Forever" + Click Element ${ACCELERATOR_TOLERATION_SECONDS_CUSTOM_RADIO} + Clear Element And Input Text ${ACCELERATOR_TOLERATION_SECONDS_CUSTOM_VALUE} ${tol_seconds} + ELSE + Click Element ${ACCELERATOR_TOLERATION_SECONDS_FOREVER_RADIO} + END + Click Button ${ACCELERATOR_TOLERATION_ADD_OR_UPDATE_BUTTON} + END + Click Button ${CREATE_OR_UPDATE_ACCELERATOR_PROFILE_DETAIL_BTN} + +Edit Accelerator Profile + [Documentation] Modify Accelerator Profile values with the ones provided in the arguments and click on + ... "Update acccelerator profile" button + ... view: Edit Accelerator profile + [Arguments] ${original_display_name} ${display_name}=${EMPTY} ${identifier}=${EMPTY} ${description}=${EMPTY} + ... ${enabled}=${EMPTY} ${tolerations}=${EMPTY} ${tol_operator}=${EMPTY} ${tol_effect}=${EMPTY} + ... ${tol_key}=${EMPTY} ${tol_value}=${EMPTY} ${tol_seconds}=${EMPTY} + Click On Edit Accelerator Profile ${original_display_name} + Wait Until Element Is Visible //h1[text()="Edit ${original_display_name}"] timeout=10 + IF "${display_name}" != "${EMPTY}" + Clear Element And Input Text ${ACCELERATOR_NAME} ${display_name} + END + IF "${identifier}" != "${EMPTY}" + Clear Element And Input Text ${ACCELERATOR_IDENTIFIER} ${identifier} + END + IF "${description}" != "${EMPTY}" + Clear Element And Input Text ${ACCELERATOR_DESCRIPTION} ${description} + END + # Click always, as there is no way from the UI to obtain the status of the switch, + IF "${enabled}" != "${EMPTY}" + Click Element ${ACCELERATOR_ENABLED_SWITCH} + END + IF "${tolerations}" != "${EMPTY}" + ${first_kebab}= Catenate SEPARATOR= ${ACCELERATOR_EDIT_TOLERATION_KEBAB_BTN} [1] + Click Button ${first_kebab} + Wait Until Element Is Visible ${first_kebab}/following::div//span[text()="Edit"] timeout=10 + Click Element ${first_kebab}/following::div//span[text()="Edit"] + Wait Until Element Is Visible ${ACCELERATOR_EDIT_TOLERATION_MODAL_FORM} timeout=10 + IF "${tol_operator}" != "${EMPTY}" + Click Button ${ACCELERATOR_TOLERATION_OPERATOR_DROPDOWN} + Click Element //div[@data-testid="toleration-operator-select"]//div[text()="${tol_operator}"] + END + IF "${tol_effect}" != "${EMPTY}" + Click Button ${ACCELERATOR_TOLERATION_EFFECT_DROPDOWN} + Click Element //label[@for="effect-select"]/parent::*/following::div//*[text()="${tol_effect}"] + END + IF "${tol_key}" != "${EMPTY}" + Clear Element And Input Text ${ACCELERATOR_TOLERATION_KEY} ${tol_key} + END + IF "${tol_value}" != "${EMPTY}" + Clear Element And Input Text ${ACCELERATOR_TOLERATION_VALUE} ${tol_value} + END + IF "${tol_seconds}" != "${EMPTY}" + IF "${tol_seconds}" != "Forever" + Click Element ${ACCELERATOR_TOLERATION_SECONDS_CUSTOM_RADIO} + Clear Element And Input Text ${ACCELERATOR_TOLERATION_SECONDS_CUSTOM_VALUE} ${tol_seconds} + ELSE + Click Element ${ACCELERATOR_TOLERATION_SECONDS_FOREVER_RADIO} + END + END + Click Button ${ACCELERATOR_TOLERATION_ADD_OR_UPDATE_BUTTON} + END + Click Button ${CREATE_OR_UPDATE_ACCELERATOR_PROFILE_DETAIL_BTN} + +Delete Accelerator Profile Tolerations + [Documentation] Delete Tolerarions from an Accelerator Profile and click on "Update acccelerator profile" button + ... view: Edit Accelerator profile + [Arguments] ${display_name} + Click On Edit Accelerator Profile ${display_name} + Wait Until Element Is Visible ${ACCELERATOR_EDIT_TOLERATION_KEBAB_BTN} + Click Element ${ACCELERATOR_EDIT_NAV_MENU_TOLERATIONS} + ${tolerations_num}= Get Element Count ${ACCELERATOR_EDIT_TOLERATION_KEBAB_BTN} + FOR ${counter} IN RANGE ${tolerations_num} + ${kebab_with_index}= Catenate SEPARATOR= ${ACCELERATOR_EDIT_TOLERATION_KEBAB_BTN} [1] + Click Button ${kebab_with_index} + Wait Until Element Is Visible ${kebab_with_index}/following::div//span[text()="Delete"] timeout=10 + Click Element ${kebab_with_index}/following::div//span[text()="Delete"] + END + Click Button ${CREATE_OR_UPDATE_ACCELERATOR_PROFILE_DETAIL_BTN} + +Accelerator Profile Should Be Displayed In The Grid + [Documentation] Verify that there is an specific Accelerator Profile in the Grid + ... view: Settings -> Accelerator profiles + [Arguments] ${display_name} + Wait Until Element Is Visible ${ACCELERATOR_PROFILE_GRID_COLUMN_NAME}//span[text()='${display_name}'] timeout=10 diff --git a/ods_ci/tests/Tests/400__ods_dashboard/410__ods_dashboard_settings.robot b/ods_ci/tests/Tests/400__ods_dashboard/410__ods_dashboard_settings.robot index e3eb20b62..0d72f1fe4 100644 --- a/ods_ci/tests/Tests/400__ods_dashboard/410__ods_dashboard_settings.robot +++ b/ods_ci/tests/Tests/400__ods_dashboard/410__ods_dashboard_settings.robot @@ -51,16 +51,6 @@ Verify That "Usage Data Collection" Can Be Set In "Cluster Settings" *** Keywords *** -Open ODS Dashboard With Admin User - [Documentation] Opens a browser and logs into ODS Dashboard with a user belonging to the rhods-admins group - Launch Dashboard ${TEST_USER.USERNAME} ${TEST_USER.PASSWORD} ${TEST_USER.AUTH_TYPE} - ... ${ODH_DASHBOARD_URL} browser=${BROWSER.NAME} browser_options=${BROWSER.OPTIONS} - -Open ODS Dashboard With Non Admin User - [Documentation] Opens a browser and logs into ODS Dashboard with a user belonging to the rhods-users group - Launch Dashboard ${TEST_USER_3.USERNAME} ${TEST_USER_3.PASSWORD} ${TEST_USER_3.AUTH_TYPE} - ... ${ODH_DASHBOARD_URL} browser=${BROWSER.NAME} browser_options=${BROWSER.OPTIONS} - Restore Default Configuration For "Usage Data Collection" And TearDown [Documentation] Restores "Usage Data Collection" default configuration and runs test teardown Verify Cluster Settings Is Available diff --git a/ods_ci/tests/Tests/400__ods_dashboard/416__ods_dashboard_settings_accelerator_profiles.robot b/ods_ci/tests/Tests/400__ods_dashboard/416__ods_dashboard_settings_accelerator_profiles.robot new file mode 100644 index 000000000..17099aa9f --- /dev/null +++ b/ods_ci/tests/Tests/400__ods_dashboard/416__ods_dashboard_settings_accelerator_profiles.robot @@ -0,0 +1,162 @@ +*** Settings *** +Resource ../../Resources/Common.robot +Resource ../../Resources/Page/ODH/ODHDashboard/ODHDashboardSettings.resource +Resource ../../Resources/Page/ODH/ODHDashboard/ODHDashboardSettingsAcceleratorProfiles.resource +Resource ../../Resources/CLI/AcceleratorProfiles/AcceleratorProfiles.resource +Resource ../../Resources/ODS.robot +Suite Setup Setup Settings Accelerator Profiles +Suite Teardown Teardown Settings Accelerator Profiles + + +*** Variables *** +${ACC2_DISPLAY_NAME}= Test: Modify Accelerator Profile 2 +${ACC3_DISPLAY_NAME}= Test: Delete Tolerations from AP 3 +${ACC4_DISPLAY_NAME}= Test: Disable AP 4 from Edit Detail View +${ACC5_DISPLAY_NAME}= Test: Enable AP 5 from Edit Detail View +${ACC6_DISPLAY_NAME}= Test: Disable AP 6 from Administration View +${ACC7_DISPLAY_NAME}= Test: Enable AP 7 from Administration View +${ACC8_DISPLAY_NAME}= Test: Delete AP 8 from grid +${ACC_NAME}= accelerator-profile-3349- +${ACC_IDENTIFIER}= nvidia.com/gpu +${ACC_DESCRIPTION}= Create Accelerator Profile +${ACC_DESCRIPTION2}= Modify Accelerator Profile +${ACC_ENABLED}= True +${ACC_TOLERATION_OPERATOR}= Exists +${ACC_TOLERATION_EFFECT}= PreferNoSchedule +${ACC_TOLERATION_KEY}= my_key +${ACC_TOLERATION_VALUE}= my_value +${ACC_TOLERATION_SECONDS}= 15 + + +*** Test Cases *** +Create An Accelerator Profile From Accelerator Profiles Administration UI + [Documentation] Create an Accelerator Profile instance from the Administration UI and verify it's content + [Tags] RHOAIENG-3349 + ... Sanity Tier1 + [Setup] Open Dashboard And Navigate To Accelerator Profiles From Settings + Create An Accelerator Profile Via UI ${ACC_NAME}1 ${ACC_IDENTIFIER} + ... ${ACC_DESCRIPTION} ${ACC_ENABLED} tolerations=yes + ... tol_operator=${ACC_TOLERATION_OPERATOR} + ... tol_effect=${ACC_TOLERATION_EFFECT} + ... tol_key=${ACC_TOLERATION_KEY} + ... tol_value=${ACC_TOLERATION_VALUE} + ... tol_seconds=${ACC_TOLERATION_SECONDS} + Accelerator Profile Should Be Displayed In The Grid ${ACC_NAME}1 + Verify Accelerator Profile Values Via CLI ${ACC_NAME}1 ${ACC_IDENTIFIER} + ... ${ACC_DESCRIPTION} ${ACC_ENABLED} tolerations=yes + ... tol_operator=${ACC_TOLERATION_OPERATOR} + ... tol_effect=${ACC_TOLERATION_EFFECT} + ... tol_key=${ACC_TOLERATION_KEY} + ... tol_value=${ACC_TOLERATION_VALUE} + ... tol_seconds=${ACC_TOLERATION_SECONDS} + +Modify An Accelerator Profile Using Accelerator Profiles Administration UI + [Documentation] Modify an Accelerator Profile instance from the Administration UI and verify it's content + [Tags] RHOAIENG-3349 + ... Sanity Tier1 + [Setup] Run Keywords Create An Accelerator Profile Via CLI ${ACC_NAME}2 + ... AND + ... Open Dashboard And Navigate to Accelerator Profiles From Settings + Edit Accelerator Profile original_display_name=${ACC2_DISPLAY_NAME} + ... display_name=${ACC2_DISPLAY_NAME}_modified + ... identifier=${ACC_IDENTIFIER}_modified + ... description=${ACC_DESCRIPTION2}_modified tolerations=yes + ... tol_operator=${ACC_TOLERATION_OPERATOR} + ... tol_effect=${ACC_TOLERATION_EFFECT} + ... tol_key=${ACC_TOLERATION_KEY} + ... tol_value=${ACC_TOLERATION_VALUE} + ... tol_seconds=${ACC_TOLERATION_SECONDS} + Accelerator Profile Should Be Displayed In The Grid ${ACC2_DISPLAY_NAME}_modified + Verify Accelerator Profile Values Via CLI ${ACC2_DISPLAY_NAME}_modified ${ACC_IDENTIFIER}_modified + ... ${ACC_DESCRIPTION2}_modified tolerations=yes + ... tol_operator=${ACC_TOLERATION_OPERATOR} + ... tol_effect=${ACC_TOLERATION_EFFECT} + ... tol_key=${ACC_TOLERATION_KEY} + ... tol_value=${ACC_TOLERATION_VALUE} + ... tol_seconds=${ACC_TOLERATION_SECONDS} + +Delete Tolerations from an Accelerator Profile Using Accelerator Profiles Administration UI + [Documentation] Delete Tolerations from an Accelerator Profile instance from the Administration UI and + ... verify it's content + [Tags] RHOAIENG-3349 + ... Sanity Tier1 + [Setup] Run Keywords Create An Accelerator Profile Via CLI ${ACC_NAME}3 + ... AND + ... Open Dashboard And Navigate to Accelerator Profiles From Settings + Delete Accelerator Profile Tolerations ${ACC3_DISPLAY_NAME} + Accelerator Profile Should Be Displayed In The Grid ${ACC3_DISPLAY_NAME} + Verify Accelerator Profile Has No Tolerations Via CLI ${ACC3_DISPLAY_NAME} + +Disable an Accelerator Profile From The Accelerator Profile Edit View + [Documentation] Disable an An accelerator profile from the Edit Accelerator Profile view + [Tags] RHOAIENG-3349 + ... Sanity Tier1 + [Setup] Run Keywords Create An Accelerator Profile Via CLI ${ACC_NAME}4 + ... AND + ... Open Dashboard And Navigate to Accelerator Profiles From Settings + Edit Accelerator Profile original_display_name=${ACC4DISPLAY_NAME} enabled=False + Accelerator Profile Should Be Displayed In The Grid ${ACC4_DISPLAY_NAME} + Verify Accelerator Profile Values Via CLI ${ACC4_DISPLAY_NAME} enabled=False + +Enable an Accelerator Profile From The Accelerator Profile Edit View + [Documentation] Enable an An accelerator profile from the Edit Accelerator Profile view + [Tags] RHOAIENG-3349 + ... Sanity Tier1 + [Setup] Run Keywords Create An Accelerator Profile Via CLI ${ACC_NAME}5 + ... AND + ... Open Dashboard And Navigate to Accelerator Profiles From Settings + Edit Accelerator Profile original_display_name=${ACC5_DISPLAY_NAME} enabled=True + Accelerator Profile Should Be Displayed In The Grid ${ACC5_DISPLAY_NAME} + Verify Accelerator Profile Values Via CLI ${ACC5_DISPLAY_NAME} enabled=True + +Disable an Accelerator Profile From The Grid of the Accelerator Profile View + [Documentation] Disable an An accelerator profile from the Edit Accelerator Profile view + [Tags] RHOAIENG-3349 + ... Sanity Tier1 + [Setup] Run Keywords Create An Accelerator Profile Via CLI ${ACC_NAME}6 + ... AND + ... Open Dashboard And Navigate to Accelerator Profiles From Settings + Search for accelerator profile in grid ${ACC6_DISPLAY_NAME} + Disable Accelerator Profile ${ACC_NAME}6 + Verify Accelerator Profile Values Via CLI ${ACC6_DISPLAY_NAME} enabled=False + +Enable an Accelerator Profile From The Grid of the Accelerator Profile View + [Documentation] Enable an An accelerator profile from the Accelerator Profile view + [Tags] RHOAIENG-3349 + ... Sanity Tier1 + [Setup] Run Keywords Create An Accelerator Profile Via CLI ${ACC_NAME}7 + ... AND + ... Open Dashboard And Navigate to Accelerator Profiles From Settings + Search for accelerator profile in grid ${ACC7_DISPLAY_NAME} + Click On The Enable Switch From Accelerator Profile ${ACC_NAME}7 + Verify Accelerator Profile Values Via CLI ${ACC7_DISPLAY_NAME} enabled=True + +Delete an Accelerator Profile From The Grid of the Accelerator Profile View + [Documentation] Delete an An accelerator profile from the Accelerator Profile view + [Tags] RHOAIENG-3349 + ... Sanity Tier1 + [Setup] Run Keywords Create An Accelerator Profile Via CLI ${ACC_NAME}8 + ... AND + ... Open Dashboard And Navigate to Accelerator Profiles From Settings + Delete Accelerator Profile ${ACC8_DISPLAY_NAME} + Accelerator Profile Should Not Exist ${ACC_NAME}8 + + +*** Keywords *** +Teardown Settings Accelerator Profiles + [Documentation] Sets the default values In User Management Settings + ... and runs the RHOSi Teardown + Delete All Accelerator Profiles Which Starts With ${ACC_NAME} + RHOSi Teardown + +Open Dashboard And Navigate to Accelerator Profiles From Settings + [Documentation] Navigate as an Admin User to the Accelerator Profiles administration view + ... Used as a Test Setup + Open ODS Dashboard With Admin User + Navigate To Page Settings Accelerator profiles + +Setup Settings Accelerator Profiles + [Documentation] Customized Steup for admin UI + Set Library Search Order SeleniumLibrary + RHOSi Setup +