forked from red-hat-data-services/ods-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Accelerators Profile Administration UI e2e Tests (red-hat-data-…
…services#1209) * feat: Accelerator Profiles administration UI e2e tests * add tolerations and verification via CLI * add variables * add modify accelerator from UI test * Add delete tolerations test case * tests for disabling, enabling and delete * delete todo and duplied test * Code scanning fixes * Code scanning fixes * Code scanning fixes * add sanity tags * add seacrh in grid capability and check ap creation return code * delete managedFields from AP files * add jira tag. Use the search in grid capability in tests * pr fixes * Refactor feature: move variables and keywords to a new file * move login keywords to a more generic file * use correct keyword for kebab actions * use suggested keyword for modal management when deleting an AP * PR Fixes * take CLI functions to CLI resources file * modify 2 keywords to be more RF consistent * delete descriptions * delete spaces from common and create a consistant test setup * modify Click enable * Modify descriptions * Linter fixes * Update ods_ci/tests/Resources/Files/accelerator/qe_accelerator_profile_2.yaml Co-authored-by: Noam Manos <[email protected]> * Update ods_ci/tests/Resources/Files/accelerator/qe_accelerator_profile_2.yaml Co-authored-by: Noam Manos <[email protected]> * add information to yamls and use jinja * Update ods_ci/tests/Resources/CLI/AcceleratorProfiles/AcceleratorProfiles.resource Co-authored-by: Jan Stourac <[email protected]> * Update ods_ci/tests/Tests/400__ods_dashboard/416__ods_dashboard_settings_accelerator_profiles.robot Co-authored-by: Jan Stourac <[email protected]> * Update ods_ci/tests/Resources/CLI/AcceleratorProfiles/AcceleratorProfiles.resource Co-authored-by: Jan Stourac <[email protected]> * fix indentation in resource field * modify accelerator profiles instance names * use APPLICATION_NAMESPACE variable * rename some variables * modify test tags * modify file names * add namespace as a dynamic variable * delete redundat teardown --------- Co-authored-by: Noam Manos <[email protected]> Co-authored-by: Jan Stourac <[email protected]>
- Loading branch information
1 parent
0d18544
commit eee7385
Showing
13 changed files
with
598 additions
and
10 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
ods_ci/tests/Resources/CLI/AcceleratorProfiles/AcceleratorProfiles.resource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
17 changes: 17 additions & 0 deletions
17
ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-3.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
18 changes: 18 additions & 0 deletions
18
ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-4.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
13 changes: 13 additions & 0 deletions
13
ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-5.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
18 changes: 18 additions & 0 deletions
18
ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-6.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
18 changes: 18 additions & 0 deletions
18
ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-7.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
12 changes: 12 additions & 0 deletions
12
ods_ci/tests/Resources/Files/accelerator/accelerator-profile-3349-8.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.