Browse Source

Check Monitor in Member Scenario Tests

Currently the Member scenario tests are not checking
if Monitor is enabled in the Tempest conf or not. This patch adds
the fix.

Change-Id: Id74ea9b232ac44e7f13c44035856bbb84eabeb63
Reedip 2 months ago
parent
commit
3e795008d5
1 changed files with 15 additions and 8 deletions
  1. 15
    8
      octavia_tempest_plugin/tests/scenario/v2/test_member.py

+ 15
- 8
octavia_tempest_plugin/tests/scenario/v2/test_member.py View File

@@ -53,7 +53,7 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
53 53
         protocol = const.HTTP
54 54
         lb_feature_enabled = CONF.loadbalancer_feature_enabled
55 55
         if not lb_feature_enabled.l7_protocol_enabled:
56
-            cls.protocol = lb_feature_enabled.l4_protocol
56
+            protocol = lb_feature_enabled.l4_protocol
57 57
 
58 58
         listener_name = data_utils.rand_name("lb_member_listener1_member")
59 59
         listener_kwargs = {
@@ -125,7 +125,10 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
125 125
         if self.lb_member_vip_subnet:
126 126
             member_kwargs[const.SUBNET_ID] = self.lb_member_vip_subnet[
127 127
                 const.ID]
128
-
128
+        hm_enabled = CONF.loadbalancer_feature_enabled.health_monitor_enabled
129
+        if not hm_enabled:
130
+            del member_kwargs[const.MONITOR_ADDRESS]
131
+            del member_kwargs[const.MONITOR_PORT]
129 132
         member = self.mem_member_client.create_member(**member_kwargs)
130 133
         self.addCleanup(
131 134
             self.mem_member_client.cleanup_member,
@@ -161,8 +164,9 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
161 164
             pool_id=self.pool_id)
162 165
 
163 166
         equal_items = [const.NAME, const.ADMIN_STATE_UP, const.ADDRESS,
164
-                       const.PROTOCOL_PORT, const.WEIGHT,
165
-                       const.MONITOR_ADDRESS, const.MONITOR_PORT]
167
+                       const.PROTOCOL_PORT, const.WEIGHT]
168
+        if hm_enabled:
169
+            equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
166 170
         if self.mem_member_client.is_version_supported(
167 171
                 self.api_version, '2.1'):
168 172
             equal_items.append(const.BACKUP)
@@ -182,8 +186,6 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
182 186
             const.NAME: new_name,
183 187
             const.ADMIN_STATE_UP: not member[const.ADMIN_STATE_UP],
184 188
             const.WEIGHT: member[const.WEIGHT] + 1,
185
-            const.MONITOR_ADDRESS: '192.0.2.3',
186
-            const.MONITOR_PORT: member[const.MONITOR_PORT] + 1,
187 189
         }
188 190
         if self.mem_member_client.is_version_supported(
189 191
                 self.api_version, '2.1'):
@@ -191,6 +193,10 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
191 193
                 const.BACKUP: not member[const.BACKUP],
192 194
             })
193 195
 
196
+        if hm_enabled:
197
+            member_update_kwargs[const.MONITOR_ADDRESS] = '192.0.2.3'
198
+            member_update_kwargs[const.MONITOR_PORT] = member[
199
+                const.MONITOR_PORT] + 1
194 200
         member = self.mem_member_client.update_member(
195 201
             member[const.ID], **member_update_kwargs)
196 202
 
@@ -208,8 +214,9 @@ class MemberScenarioTest(test_base.LoadBalancerBaseTest):
208 214
             pool_id=self.pool_id)
209 215
 
210 216
         # Test changed items
211
-        equal_items = [const.NAME, const.ADMIN_STATE_UP, const.WEIGHT,
212
-                       const.MONITOR_ADDRESS, const.MONITOR_PORT]
217
+        equal_items = [const.NAME, const.ADMIN_STATE_UP, const.WEIGHT]
218
+        if hm_enabled:
219
+            equal_items += [const.MONITOR_ADDRESS, const.MONITOR_PORT]
213 220
         if self.mem_member_client.is_version_supported(
214 221
                 self.api_version, '2.1'):
215 222
             equal_items.append(const.BACKUP)

Loading…
Cancel
Save