-
Notifications
You must be signed in to change notification settings - Fork 165
[RFR] Added Pod.pods_per_ready_status + Fix smart management test #4922
Conversation
af39366
to
eb32d7b
Compare
|
||
for status in cfme_pod_condition: | ||
soft_assert(ose_pod_condition[status] == cfme_pod_condition[status], | ||
'Expected "{}" status for pod {} is {}. Found {} instead.' |
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 English grammar is bad in the error message and it doesn't match the assert condition. Why it is not saying something like
The Pod {} status mismatch: It is "{}" in openshift while cfme sees "{}".
Not mentioning that it doesn't make much sense to me why one needs to first group the pods by it status to compare them then. It smells like the Polarion prescription is bad, but I cannot check it in the moment.
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.
No problem I'll fix that.
return wait_for(lambda: getattr(obj_inst.summary.smart_management, | ||
'my_company_tags', []), fail_condition=[], | ||
num_sec=30, delay=5, fail_func=obj_inst.summary.reload).out.pop() | ||
except TimedOutError: |
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.
-
Why did you choose to silence the exception?
-
Returning none will cause problems at lines 89 and 98
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.
"General fixes" is too general for patch title.
eb32d7b
to
1d0cb30
Compare
09c5d59
to
071011e
Compare
@@ -132,8 +134,7 @@ | |||
] | |||
|
|||
|
|||
@pytest.mark.parametrize('test_item', TEST_ITEMS, | |||
ids=[ti.args[1].pretty_id() for ti in TEST_ITEMS]) | |||
@pytest.mark.parametrize('test_item', TEST_ITEMS) |
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.
Why remove this?
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.
causes problem when there is a bugzilla marker, it's too complicating the way to call that (sometimes args[1].pretty_id, sometimes args[0].args[1].pretty_id). I can create some function that treat this but i think it's too much for this purpose. what you think?
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 need to have something that is either a string, or has a .name attribute for a parameter else it will screw up future reporting.
@@ -143,7 +144,6 @@ def test_properties(provider, test_item, soft_assert): | |||
|
|||
for instance in instances: | |||
|
|||
navigate_to(instance, 'Details') |
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 don't need to navigate anymore?
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.
No, The instance.summary below is already do it for us.
""" | ||
|
||
navigate_to(provider, 'Details') | ||
tb.select('Reload Current Display') | ||
provider.validate_stats(ui=True) |
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.
Is the refresh done as part of this func 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.
@@ -91,24 +76,24 @@ def test_container_reports_base_on_options(soft_assert): | |||
soft_assert(option, 'Could not find option "{}" for base report on.'.format(base_on)) | |||
|
|||
|
|||
@pytest.mark.meta(blockers=[BZ(1435958, forced_streams=["5.8"])]) | |||
@pytest.mark.meta(blockers=[BZ(1467059, forced_streams=["5.8"])]) |
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.
If the bug applies to all the tests in the file, you can mark the test at the beginning of the file and apply it to all
071011e
to
752e05c
Compare
|
||
|
||
@pytest.fixture(scope='function') | ||
def pods_per_ready_status(provider): |
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 dont see a need for this to be a fixture, this could just be a method on the container object
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.
OK, so it should be on the Pod object as static method for all pods (since we want just 1 API call)
7b441df
to
f7a84ab
Compare
f7a84ab
to
7b441df
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.
One minor change
cfme/containers/pod.py
Outdated
@@ -57,6 +59,19 @@ def get_random_instances(cls, provider, count=1, appliance=None): | |||
return [cls(obj.name, obj.project_name, provider, appliance=appliance) | |||
for obj in itertools.islice(pod_list, count)] | |||
|
|||
@staticmethod |
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.
So, a few things here,
- This function/method is dealing with pods from a specific provider
Therefore, either this function should be a method of the provider object, then there is no need to pass a provider to it.
7b441df
to
f8c1a2d
Compare
cfme/containers/pod.py
Outdated
@@ -3,6 +3,8 @@ | |||
import random | |||
import itertools | |||
|
|||
from wrapanapi.utils import eval_strings |
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.
lint bot isn't running right now, this isn't used anywhere in the module?
|
||
|
||
from cfme.base.login import BaseLoggedInPage |
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.
👍
cfme/containers/provider/__init__.py
Outdated
def pods_per_ready_status(self): | ||
"""Grabing the Container Statuses Summary of the pods from API""" | ||
# TODO: Add later this logic to wrapanapi | ||
entities_j = self.mgmt.api.get('pod')[1]['items'] |
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.
why _j
on this variable name? nitpicking, but it doesn't seem to make sense, entities
would be sufficient.
@@ -269,6 +270,18 @@ def num_image_registry(self): | |||
def num_image_registry_ui(self): | |||
return int(self.get_detail("Relationships", "Image Registries")) | |||
|
|||
def pods_per_ready_status(self): | |||
"""Grabing the Container Statuses Summary of the pods from API""" | |||
# TODO: Add later this logic to wrapanapi |
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.
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.
(+ @psav ) Indeed, I didn't forgot that, my next step will be to migrate all these functions to wrapanapi (this is not the only one, I have similar TODOS all over the framework)
69cba31
to
91bb084
Compare
91bb084
to
29a9fd8
Compare
{{pytest: cfme/tests/containers/test_reload_button_provider.py cfme/tests/containers/test_properties.py cfme/tests/containers/test_reports.py cfme/tests/containers/test_smart_management.py -v --use-provider cm-env2}}