Skip to content

Commit 6f9bed7

Browse files
authored
[Fix] to distinguish between PVC in pending and PVC in bound status (#1070)
The storage size is shown in the UI depending of the PVC status. Before the PVC is bounded, there is shown 'Max XXGi' (or other unit). After the PVC has been bound (even after it has been de-attached from a workbench) then there is something like: 'XXGi [## ] YYGi' - so there is shown both the capacity that is taken and total capacity of the storage; in the middle of them, there is a graphical element to show how much the capacity is used.
1 parent ca84325 commit 6f9bed7

File tree

1 file changed

+40
-6
lines changed

1 file changed

+40
-6
lines changed

ods_ci/tests/Resources/Page/ODH/ODHDashboard/ODHDataScienceProject/Storages.resource

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,46 @@ Storage Size Should Be
4747
Run Keyword And Continue On Failure Wait Until Page Contains Element ${STORAGE_SECTION_XP}
4848
Click Element ${STORAGE_SECTION_XP}//tr[td//*/div[text()="${name}"]]//button[@aria-label="Details"]
4949
Wait Until Element Is Visible ${STORAGE_SECTION_XP}//tr[@class="pf-c-table__expandable-row pf-m-expanded"]
50-
Wait Until Page Contains Element ${STORAGE_SECTION_XP}//tr[@class="pf-c-table__expandable-row pf-m-expanded"]/td/div[strong[text()="Size"]]/div timeout=45s
51-
${displayed_size}= Get Text ${STORAGE_SECTION_XP}//tr[@class="pf-c-table__expandable-row pf-m-expanded"]/td/div[strong[text()="Size"]]/div
52-
Run Keyword And Continue On Failure Should Be Equal As Strings ${displayed_size} Max ${size}Gi
53-
${rc} ${oc_object_size}= Run And Return Rc And Output oc get pvc -n ${namespace} -o jsonpath='{.items[?(@.metadata.annotations.openshift\\.io/display-name=="${name}")].spec.resources.requests.storage}'
54-
Run Keyword And Continue On Failure Should Be Equal As Strings ${oc_object_size} ${size}Gi
55-
${rc} ${oc_object_size}= Run And Return Rc And Output oc get pvc -n ${namespace} -o jsonpath='{.items[?(@.metadata.annotations.openshift\\.io/display-name=="${name}")].status.capacity.storage}'
50+
51+
${rc} ${pvc_status_phase}= Run And Return Rc And Output
52+
... oc get pvc -n ${namespace} -o jsonpath='{.items[?(@.metadata.annotations.openshift\\.io/display-name=="${name}")].status.phase}' # robocop: disable
53+
Should Be Equal As Integers ${rc} 0 An error occurred during the check of PVC ${name} .status.phase value!
54+
IF "${pvc_status_phase}" == "Pending"
55+
# PVC hasn't been bound yet - only simple text with max storage should be shown
56+
${storage_size_el}= Set Variable
57+
... ${STORAGE_SECTION_XP}//tr[@class="pf-c-table__expandable-row pf-m-expanded"]/td/div[strong[text()="Size"]]/div # robocop: disable
58+
Wait Until Page Contains Element ${storage_size_el} timeout=20s
59+
${displayed_size}= Get Text ${storage_size_el}
60+
Run Keyword And Continue On Failure Should Be Equal As Strings ${displayed_size} Max ${size}Gi
61+
ELSE IF "${pvc_status_phase}" == "Bound"
62+
# PVC is now or had been bound already sometime in past - there is:
63+
# - a number stating current usage
64+
# - a bar showing current usage of storage in a graphic manner
65+
# - and finally an acutal storage size number
66+
# Note: it may take some time before UI updates the storage
67+
# info WRT cluster usage, look like it does so every 60s
68+
${bound_storage_size_el}= Set Variable
69+
... ${STORAGE_SECTION_XP}//tr[@class="pf-c-table__expandable-row pf-m-expanded"]/td/div[strong[text()="Size"]]/div/div[3]/div # robocop: disable
70+
Wait Until Page Contains Element ${bound_storage_size_el} timeout=65s
71+
${displayed_size}= Get Text ${bound_storage_size_el}
72+
Run Keyword And Continue On Failure Should Be Equal As Strings ${displayed_size} ${size}Gi
73+
${rc} ${oc_object_size}= Run And Return Rc And Output
74+
... oc get pvc -n ${namespace} -o jsonpath='{.items[?(@.metadata.annotations.openshift\\.io/display-name=="${name}")].status.capacity.storage}' # robocop: disable
75+
Should Be Equal As Integers ${rc} 0
76+
... An error occurred during the check of PVC ${name} '.status.capacity.storage' value!
77+
Run Keyword And Continue On Failure Should Be Equal As Strings ${oc_object_size} ${size}Gi
78+
ELSE
79+
${error_msg}= Catenate The PVC is in a '${pvc_status_phase}' state which we don't expect for this
80+
... scenario. We expect either 'Pending' or 'Bound' states here. Please, either complete the
81+
... implementation or investigate the test failure.
82+
Fail ${error_msg}
83+
RETURN 1
84+
END
85+
# This check is common for both "Pending" and "Bound" states of PVC.
86+
${rc} ${oc_object_size}= Run And Return Rc And Output
87+
... oc get pvc -n ${namespace} -o jsonpath='{.items[?(@.metadata.annotations.openshift\\.io/display-name=="${name}")].spec.resources.requests.storage}' # robocop: disable
88+
Should Be Equal As Integers ${rc} 0
89+
... An error occurred during the check of PVC ${name} '.spec.resources.requests.storage' value!
5690
Run Keyword And Continue On Failure Should Be Equal As Strings ${oc_object_size} ${size}Gi
5791

5892
Create PersistentVolume Storage

0 commit comments

Comments
 (0)