-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add tests for by-id path #1518
base: master
Are you sure you want to change the base?
Add tests for by-id path #1518
Conversation
fbe1fa4
to
fd2a534
Compare
Hello @katlapinka! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2024-11-14 10:27:04 UTC |
fd2a534
to
42958a2
Compare
42958a2
to
431d18f
Compare
""" | ||
title: Test for adding core with by-id path. | ||
description: | | ||
Check if OpenCAS accepts by-id path to disks added as cores. |
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.
indent x 4
- Cores are added to cache with the same path as given | ||
""" | ||
with TestRun.step("Prepare partitions for cache and for cores."): | ||
cache_dev = TestRun.disks['cache'] |
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.
cache_dev = TestRun.disks["cache"]
cache_dev = TestRun.disks['cache'] | ||
cache_dev.create_partitions([Size(200, Unit.MebiByte)]) | ||
cache_part = cache_dev.partitions[0] | ||
core_dev = TestRun.disks['core'] |
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.
core_dev = TestRun.disks["core"]
for i in range(cores_number): | ||
cache.add_core(core_dev.partitions[i]) |
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.
for core_dev_part in core_dev.partitions:
cache.add_core(core_dev_part)
if added_cores_number != cores_number: | ||
TestRun.fail(f"Expected {cores_number} cores, got {added_cores_number}!") | ||
|
||
for i, core in enumerate(added_cores): |
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.
How about
'for a,b in zip(added_cores, core_dev.partitions):'
if listed_cores_number != cores_number: | ||
TestRun.fail(f"Expected {cores_number} cores, got {listed_cores_number}!") | ||
|
||
for core in listed_cores: |
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.
Small refactor for that
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.
?
def create_init_config(cache, cores, paths): | ||
init_conf = InitConfig() | ||
|
||
def _add_core(core, path): |
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.
not sure if creating function to use it once, few lines after definition is best practice
|
||
if len(core_pool_list) != 0: | ||
TestRun.error(f"No cores expected in core pool. Got {core_pool_list}") | ||
else: | ||
TestRun.LOGGER.info("Core pool is ok") | ||
|
||
expected_caches_paths = set([active_cache_path, standby_cache_path]) | ||
expected_caches_paths = {active_cache_path, standby_cache_path} | ||
caches_paths = {c["device"] for c in caches_list} |
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.
are we sure that this is cache path?
|
||
if len(core_pool_list) != 0: | ||
TestRun.error(f"No cores expected in core pool. Got {core_pool_list}") | ||
else: | ||
TestRun.LOGGER.info("Core pool is ok") | ||
|
||
expected_caches_paths = set([active_cache_path, standby_cache_path]) | ||
expected_caches_paths = {active_cache_path, standby_cache_path} |
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.
Not sure if active_cache_path is correct naming for cache_disk_path
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 assume those names gives us more info what are there caches than "first_cache" and "second_cache" names
f"Expected the following devices as caches " | ||
f"{expected_caches_paths}. Got {caches_paths}" | ||
) | ||
else: | ||
TestRun.LOGGER.info("Caches are ok") | ||
|
||
expected_core_paths = set([active_core_path]) | ||
expected_core_paths = {active_core_path} |
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.
Not sure if active_core_path is correct naming for core_disk_path
431d18f
to
51499a7
Compare
Signed-off-by: Katarzyna Treder <[email protected]>
51499a7
to
68ef9f9
Compare
Original PR:
#931
Needs:
Open-CAS/test-framework#14