-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating blockpool tests with capacity and usage verifications #9784
base: master
Are you sure you want to change the base?
Updating blockpool tests with capacity and usage verifications #9784
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR validation on existing cluster
Cluster Name: sdurgbun-test411
Cluster Configuration:
PR Test Suite: tier1
PR Test Path: tests/cross_functional/ui/test_create_pool_block_pool.py
Additional Test Params:
OCP VERSION: 4.11-ga
OCS VERSION: 4.11
tested against branch: master
ocs_ci/ocs/ui/views.py
Outdated
), | ||
"immediate_binding_mode": ("button[id='Immediate-link']", By.CSS_SELECTOR), | ||
"storage_class_breadcrumb": ( | ||
"//a[@class='pf-c-breadcrumb__link'][text()='StorageClasses']", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This locator won't work in 4.16, after patternfly 5 changes. Could you please re-check the locators for a 4.16 cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure will check it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the tests are working fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be that you're not actually using this locator in the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea I see its not used, will remove storage_class_breadcrumb locater
PR verification was done against OCP VERSION: 4.11-ga OCS VERSION: 4.11 and we want to merge to 4.16/master branch. |
pytest.param(*[2, False], marks=pytest.mark.polarion_id("OCS-2586")), | ||
# pytest.param(*[3, False], marks=pytest.mark.polarion_id("OCS-2588")), | ||
# pytest.param(*[2, True], marks=pytest.mark.polarion_id("OCS-2587")), | ||
# pytest.param(*[2, False], marks=pytest.mark.polarion_id("OCS-2586")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most likely this is a leftover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the comments
ocs_ci/ocs/ui/block_pool.py
Outdated
f"Raw capacity of {pool_name} is {raw_capacity} MiB as checked by CLI" | ||
) | ||
|
||
used_raw_capacity_in_UI = self.get_element_text( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have this functionality, please check - def get_raw_capacity_card_values(self)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with function call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR validation on existing cluster
Cluster Name: sdurgbun-odf416
Cluster Configuration:
PR Test Suite: tier1
PR Test Path: tests/cross_functional/ui/test_create_pool_block_pool.py
Additional Test Params:
OCP VERSION: 4.16
OCS VERSION: 4.16
tested against branch: master
ocs_ci/ocs/ui/block_pool.py
Outdated
|
||
raw_capacity_loaded = self.check_element_text( | ||
"Available", | ||
"div[@class='ceph-raw-card-legend__title']", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move the actual locator to the views.py file?
ocs_ci/ocs/ui/views.py
Outdated
@@ -1135,6 +1131,15 @@ | |||
"//p[@data-test='pool-bound-message']", | |||
By.XPATH, | |||
), | |||
"used_raw_capacity_in_UI": ("//div[@class='ceph-raw-card-legend__text']", By.XPATH), | |||
"actions_inside_pool": ( | |||
"//div[@class='pf-c-dropdown pf-m-align-right']", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This locator also shouldn't be working in 4.16 and I don't see it used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used in older versions here
ocs-ci/ocs_ci/ocs/ui/block_pool.py
Line 90 in 354fc23
self.do_click(self.bp_loc["actions_inside_pool"]) |
and the code is also working for 4.16 as well I have checked.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shivamdurgbuns The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1 similar comment
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shivamdurgbuns The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR validation on existing cluster
Cluster Name: sdurgbun-test416
Cluster Configuration:
PR Test Suite: tier1
PR Test Path: tests/cross_functional/ui/test_create_pool_block_pool.py
Additional Test Params:
OCP VERSION: 4.16
OCS VERSION: 4.16
tested against branch: master
Job UNSTABLE (some or all tests failed).
All the tests have passed here |
ocs_ci/ocs/ui/block_pool.py
Outdated
""" | ||
self.navigate_block_pool_page() | ||
self.page_has_loaded() | ||
self.do_click((f"//a[text()='{pool_name}']", By.XPATH)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move the locator to views.py file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we cant move this locator to the views.py as the locator is dynamic and we cant pass the pool name value to the views file as we are picking the locators from dictionary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest defining it the way we do in other such cases: https://github.com/red-hat-storage/ocs-ci/blob/master/ocs_ci/ocs/ui/views.py#L287
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
ocs_ci/ocs/ui/block_pool.py
Outdated
|
||
def select_blockpool(self, pool_name): | ||
""" | ||
Selects and clicks on the blocpool according to the blockpool name passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: blocpool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
ocs_ci/ocs/ui/block_pool.py
Outdated
bf_obj = BlockAndFile() | ||
used_raw_capacity_in_UI, _ = bf_obj.get_raw_capacity_card_values() | ||
|
||
if used_raw_capacity_in_UI == f"{str(raw_capacity)} MiB": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raw capacity units are dynamic, may be MiB and may be not.
Since this function is a utility and not supposed to work only against one test, and we don't know what pool_name will be in the future use of it, we need to convert MiB from the "int(pools["size_kb"]) / 1024, 1" in whatever values are correct in a human readable format.
or
use another approach:
Convert values from UI and from CLI to bytes and compare bytes. Use human_to_bytes_ui()
from ocs_ci/utility/utils.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
ocs_ci/ocs/ui/block_pool.py
Outdated
return True | ||
else: | ||
logger.error( | ||
f"UI value (i.e {used_raw_capacity_in_UI}) did not matched as per CLI for the Raw Capacity" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did not match
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR validation on existing cluster
Cluster Name: sdurgbun-odf416
Cluster Configuration:
PR Test Suite: tier1
PR Test Path: tests/cross_functional/ui/test_create_pool_block_pool.py
Additional Test Params:
OCP VERSION: 4.16
OCS VERSION: 4.16
tested against branch: master
Job UNSTABLE (some or all tests failed).
All the tests passed here, error in teardown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR validation on existing cluster
Cluster Name: sdurgbun-odf416
Cluster Configuration:
PR Test Suite: tier1
PR Test Path: tests/cross_functional/ui/test_create_pool_block_pool.py
Additional Test Params:
OCP VERSION: 4.16
OCS VERSION: 4.16
tested against branch: master
Job UNSTABLE (some or all tests failed).
88e2e71
to
72b5b4b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR validation on existing cluster
Cluster Name: sdurgbun-odf416
Cluster Configuration:
PR Test Suite: tier1
PR Test Path: tests/cross_functional/ui/test_create_pool_block_pool.py
Additional Test Params:
OCP VERSION: 4.16
OCS VERSION: 4.16
tested against branch: master
Job UNSTABLE (some or all tests failed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR validation on existing cluster
Cluster Name: sdurgbun-odf416
Cluster Configuration:
PR Test Suite: tier1
PR Test Path: tests/cross_functional/ui/test_create_pool_block_pool.py
Additional Test Params:
OCP VERSION: 4.16
OCS VERSION: 4.16
tested against branch: master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR validation on existing cluster
Cluster Name: sdurgbun-test416
Cluster Configuration:
PR Test Suite: tier1
PR Test Path: tests/cross_functional/ui/test_create_pool_block_pool.py
Additional Test Params:
OCP VERSION: 4.16
OCS VERSION: 4.16
tested against branch: master
Job UNSTABLE (some or all tests failed).
I have ran the test here and all have passed, could we please merge this pr |
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
b907c6c
to
3241cda
Compare
ocs_ci/ocs/exceptions.py
Outdated
@@ -706,7 +706,10 @@ class ClusterNotInSTSModeException(Exception): | |||
|
|||
class APIRequestError(Exception): | |||
pass | |||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove merge conflict leftovers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
@@ -4776,3 +4776,22 @@ def is_rbd_default_storage_class(custom_sc=None): | |||
|
|||
logger.error("Storageclass {default_rbd_sc} is not a default RBD StorageClass.") | |||
return False | |||
def custom_round(number): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, no new line before the end of the previous method return statement and custom_round
is one of the reasons PR does not pass PR validation (Tox) check
number_str = str(number) | ||
|
||
# Check if the decimal part exists and ends in ".5" | ||
if "." in number_str and number_str.endswith(".5"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey.
Func may cause the bugs
-
Input: 2.504
Expected Output: 3 (since it's slightly more than 2.5)
Actual Output: 2 (since .endswith(".5") check fails due to floating-point representation) -
Negative numbers and numbers such as 3.49 will also cause the bug.
We don't need this function in helpers, it is not universal and to specific to your needs, please move the logic to the test or function to the test module.
# splitting the ouptut with spaces | ||
# the blockpool used capacity will always be at index 17 and 18 | ||
# where the index 17 is the value and index 18 is the unit | ||
used_capacity_in_CLI, unit = df_op.split()[17:19] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[17:19] - is this aways the case, even when numbers and units are different? I think we need some dynamic/intelectual parsing here to get numbers from the text. Please use regex-like approaches to get what you need from the string
self.navigate_block_pool_page() | ||
self.page_has_loaded() | ||
self.do_click( | ||
locator=format_locator(self.generic_locators["blockpool_name"], pool_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
@@ -118,6 +120,13 @@ def test_create_delete_pool( | |||
# Getting IO results | |||
get_fio_rw_iops(self.pod_obj) | |||
|
|||
# Checking the raw capcity is loaded on the UI or not. | |||
blockpool_ui_object = BlockPoolUI() | |||
assert blockpool_ui_object.pool_raw_capacity_loaded(self.pool_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! Please add a string explanation to the assertion
assert blockpool_ui_object.pool_raw_capacity_loaded(self.pool_name), "Block pool raw capacity is not visible on UI"
assert blockpool_ui_object.pool_raw_capacity_loaded(self.pool_name) | ||
|
||
# Cross checking the raw capacity of the blockpool between CLI and UI | ||
assert blockpool_ui_object.cross_check_raw_capacity(self.pool_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, please use string explanation
Re-opening old PR #6609