Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[RFR] Added Pod.pods_per_ready_status + Fix smart management test #4922

Merged
merged 1 commit into from
Jul 12, 2017

Conversation

gshefer
Copy link
Contributor

@gshefer gshefer commented Jun 28, 2017

{{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}}

  • Created Pod.pods_per_ready_status in order to be able to share this usage between test_pods_conditions and test_report_pods_per_ready_status
  • Fixed test_smart_management which didn't wait enough time to the tags to be populated.

@gshefer gshefer force-pushed the general_fixes_pt2 branch 3 times, most recently from af39366 to eb32d7b Compare July 4, 2017 12:23
@gshefer gshefer changed the title [WIPTEST] General Fixes [RFR] General Fixes Jul 4, 2017

for status in cfme_pod_condition:
soft_assert(ose_pod_condition[status] == cfme_pod_condition[status],
'Expected "{}" status for pod {} is {}. Found {} instead.'
Copy link
Contributor

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.

Copy link
Contributor Author

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why did you choose to silence the exception?

  2. Returning none will cause problems at lines 89 and 98

Copy link
Contributor

@jarovo jarovo left a 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.

@gshefer gshefer force-pushed the general_fixes_pt2 branch from eb32d7b to 1d0cb30 Compare July 4, 2017 13:18
@gshefer gshefer closed this Jul 4, 2017
@gshefer gshefer reopened this Jul 4, 2017
@gshefer gshefer changed the title [RFR] General Fixes [1LP][RFR] General Fixes Jul 4, 2017
@gshefer gshefer closed this Jul 4, 2017
@gshefer gshefer reopened this Jul 4, 2017
@gshefer gshefer changed the title [1LP][RFR] General Fixes [1LP][RFR] Add pods_per_ready_status fixture + Fix smart management test Jul 4, 2017
@gshefer gshefer force-pushed the general_fixes_pt2 branch 4 times, most recently from 09c5d59 to 071011e Compare July 5, 2017 08:14
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

Copy link
Contributor Author

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?

Copy link
Contributor

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')
Copy link
Contributor

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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"])])
Copy link
Contributor

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

@gshefer gshefer force-pushed the general_fixes_pt2 branch from 071011e to 752e05c Compare July 5, 2017 13:04


@pytest.fixture(scope='function')
def pods_per_ready_status(provider):
Copy link
Contributor

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

Copy link
Contributor Author

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)

@gshefer gshefer force-pushed the general_fixes_pt2 branch 6 times, most recently from 7b441df to f7a84ab Compare July 6, 2017 13:15
@gshefer gshefer force-pushed the general_fixes_pt2 branch from f7a84ab to 7b441df Compare July 6, 2017 13:16
@gshefer gshefer changed the title [1LP][RFR] Add pods_per_ready_status fixture + Fix smart management test [1LP][RFR] Add Pod.pods_per_ready_status + Fix smart management test Jul 9, 2017
@gshefer gshefer changed the title [1LP][RFR] Add Pod.pods_per_ready_status + Fix smart management test [1LP][RFR] Added Pod.pods_per_ready_status + Fix smart management test Jul 9, 2017
Copy link
Contributor

@psav psav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor change

@@ -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
Copy link
Contributor

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,

  1. 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.

@psav psav changed the title [1LP][RFR] Added Pod.pods_per_ready_status + Fix smart management test [1LP][WIP] Added Pod.pods_per_ready_status + Fix smart management test Jul 11, 2017
@gshefer gshefer force-pushed the general_fixes_pt2 branch from 7b441df to f8c1a2d Compare July 11, 2017 09:42
@gshefer gshefer changed the title [1LP][WIP] Added Pod.pods_per_ready_status + Fix smart management test [1LP][WIPTEST] Added Pod.pods_per_ready_status + Fix smart management test Jul 11, 2017
@gshefer gshefer changed the title [1LP][WIPTEST] Added Pod.pods_per_ready_status + Fix smart management test [1LP][RFR] Added Pod.pods_per_ready_status + Fix smart management test Jul 11, 2017
@mshriver mshriver changed the title [1LP][RFR] Added Pod.pods_per_ready_status + Fix smart management test [RFR] Added Pod.pods_per_ready_status + Fix smart management test Jul 11, 2017
@@ -3,6 +3,8 @@
import random
import itertools

from wrapanapi.utils import eval_strings
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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']
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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)

@gshefer gshefer force-pushed the general_fixes_pt2 branch 2 times, most recently from 69cba31 to 91bb084 Compare July 11, 2017 15:03
@gshefer gshefer force-pushed the general_fixes_pt2 branch from 91bb084 to 29a9fd8 Compare July 11, 2017 15:08
@psav psav merged commit 45893f3 into ManageIQ:master Jul 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants