Browse Source

Merge "Add wait until active LB in NP test"

changes/70/824770/1
Zuul 4 months ago committed by Gerrit Code Review
parent
commit
5fd8c32c31
  1. 23
      kuryr_tempest_plugin/tests/scenario/base.py
  2. 10
      kuryr_tempest_plugin/tests/scenario/test_network_policy.py

23
kuryr_tempest_plugin/tests/scenario/base.py

@ -1508,6 +1508,18 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
self.addClassResourceCleanup(self.delete_pod, pod_name,
namespace=namespace)
self.wait_until_service_LB_is_active(service_name, namespace)
self.assert_backend_amount_from_pod(
clusterip_svc_ip,
pod_num,
pod_name,
service_port,
protocol,
namespace_name=namespace)
return pod_name
def wait_until_service_LB_is_active(self, service_name,
namespace='default', poll_interval=5):
if CONF.kuryr_kubernetes.kuryrloadbalancers:
klb_crd_id = self.get_klb_crd_id(service_name, namespace)
start = time.time()
@ -1522,21 +1534,12 @@ class BaseKuryrScenarioTest(manager.NetworkScenarioTest):
if loadbalancer.get("provisioning_status") == "ACTIVE":
LOG.info("LB is ACTIVE: %s", klb_crd_id)
break
time.sleep(10)
time.sleep(poll_interval)
else:
msg = ("Timed out waiting for loadbalancer %s to become"
" ACTIVE", klb_crd_id)
raise lib_exc.TimeoutException(msg)
self.assert_backend_amount_from_pod(
clusterip_svc_ip,
pod_num,
pod_name,
service_port,
protocol,
namespace_name=namespace)
return pod_name
def get_curl_template(self, ip_or_cidr, extra_args='', port=False):
ipn = netaddr.IPNetwork(ip_or_cidr)

10
kuryr_tempest_plugin/tests/scenario/test_network_policy.py

@ -296,6 +296,8 @@ class ServiceWOSelectorsNPScenario(base.BaseKuryrScenarioTest):
self.verify_lbaas_endpoints_configured(service_name, 1, server_ns_name)
self.verify_lbaas_endpoints_configured(service2_name, 1,
server_ns_name)
self.wait_until_service_LB_is_active(service_name, server_ns_name)
self.wait_until_service_LB_is_active(service2_name, server_ns_name)
# check connectivity
curl_tmpl = self.get_curl_template(service_ip, extra_args='-m 10')
@ -303,10 +305,14 @@ class ServiceWOSelectorsNPScenario(base.BaseKuryrScenarioTest):
cmd2 = ["/bin/sh", "-c", curl_tmpl.format(service2_ip)]
self.assertIn(consts.POD_OUTPUT,
self.exec_command_in_pod(client_pod_name, cmd,
namespace=client_ns_name))
namespace=client_ns_name),
"Connectivity from %s to service %s (%s) failed." %
(client_pod_name, service_ip, service_name))
self.assertIn(consts.POD_OUTPUT,
self.exec_command_in_pod(client_pod_name, cmd2,
namespace=client_ns_name))
namespace=client_ns_name),
"Connectivity from %s to service2 %s (%s) failed." %
(client_pod_name, service2_ip, service2_name))
# create NP for client to be able to reach server
np_name = data_utils.rand_name(prefix='kuryr-np')

Loading…
Cancel
Save