From 679ee2414f0daf57ecf9b505672f21fd85d2aa01 Mon Sep 17 00:00:00 2001 From: Sumit Jamgade Date: Tue, 11 Jul 2017 16:53:17 +0200 Subject: [PATCH] fixed health monitor setting during tempest test, `resource_set_health_monitor` is a class method, so the `cls` param will be a class object and not an instantiated object, whereas `_create_health_monitor` is not a classmethod can thus be called only when bound to an object. This fix keeps the method as classmethod and allows passing a `creater` which can be used as factory of `health monitors` Change-Id: I192bec90097be92fda122b01aebf9e820ea7bb67 Closes-bug: 1703597 --- neutron_lbaas/tests/tempest/v2/ddt/base_ddt.py | 5 ++--- .../tempest/v2/ddt/test_health_monitor_admin_state_up.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/neutron_lbaas/tests/tempest/v2/ddt/base_ddt.py b/neutron_lbaas/tests/tempest/v2/ddt/base_ddt.py index b0bfa6147..d53462af1 100644 --- a/neutron_lbaas/tests/tempest/v2/ddt/base_ddt.py +++ b/neutron_lbaas/tests/tempest/v2/ddt/base_ddt.py @@ -100,15 +100,14 @@ class AdminStateTests(testscenarios.TestWithScenarios, cls.member_id = cls.member['id'] @classmethod - def resource_set_health_monitor(cls, admin_state_up_flag): + def resource_set_health_monitor(cls, admin_state_up_flag, creator): cls.create_hm_kwargs = {'type': cls.protocol, 'delay': 3, 'max_retries': 10, 'timeout': 5, 'pool_id': cls.pool_id, 'admin_state_up': admin_state_up_flag} - cls.health_monitor = cls._create_health_monitor( - **cls.create_hm_kwargs) + cls.health_monitor = creator(**cls.create_hm_kwargs) cls.health_monitor_id = cls.health_monitor['id'] @classmethod diff --git a/neutron_lbaas/tests/tempest/v2/ddt/test_health_monitor_admin_state_up.py b/neutron_lbaas/tests/tempest/v2/ddt/test_health_monitor_admin_state_up.py index 5add91334..2fddf0e7d 100644 --- a/neutron_lbaas/tests/tempest/v2/ddt/test_health_monitor_admin_state_up.py +++ b/neutron_lbaas/tests/tempest/v2/ddt/test_health_monitor_admin_state_up.py @@ -74,8 +74,8 @@ class BaseHealthMonitorAdminStateTest(base_ddt.AdminStateTests): self.resource_setup_pool(self.pool_flag) self.addCleanup(self._delete_pool, self.pool_id) - - self.resource_set_health_monitor(self.healthmonitor_flag) + self.resource_set_health_monitor(self.healthmonitor_flag, + self._create_health_monitor) self.addCleanup(self._delete_health_monitor, self.health_monitor_id) @classmethod