Merge "Amend check_sg_rules_for_np() method"

This commit is contained in:
Zuul 2022-01-24 11:06:31 +00:00 committed by Gerrit Code Review
commit 4d7bf141fa

View File

@ -66,8 +66,6 @@ class TestNetworkPolicyScenario(base.BaseKuryrScenarioTest,
egress_cidrs_should_exist=(), egress_cidrs_should_exist=(),
ingress_cidrs_shouldnt_exist=(), ingress_cidrs_shouldnt_exist=(),
egress_cidrs_shouldnt_exist=()): egress_cidrs_shouldnt_exist=()):
ingress_cidrs_found = set()
egress_cidrs_found = set()
ingress_cidrs_should_exist = set(ingress_cidrs_should_exist) ingress_cidrs_should_exist = set(ingress_cidrs_should_exist)
egress_cidrs_should_exist = set(egress_cidrs_should_exist) egress_cidrs_should_exist = set(egress_cidrs_should_exist)
ingress_cidrs_shouldnt_exist = set(ingress_cidrs_shouldnt_exist) ingress_cidrs_shouldnt_exist = set(ingress_cidrs_shouldnt_exist)
@ -77,6 +75,8 @@ class TestNetworkPolicyScenario(base.BaseKuryrScenarioTest,
start = time.time() start = time.time()
while not rules_match and (time.time() - start) < TIMEOUT_PERIOD: while not rules_match and (time.time() - start) < TIMEOUT_PERIOD:
ingress_cidrs_found = set()
egress_cidrs_found = set()
sg_rules = self.get_sg_rules_for_np(namespace, np) sg_rules = self.get_sg_rules_for_np(namespace, np)
for rule in sg_rules: for rule in sg_rules:
@ -94,8 +94,9 @@ class TestNetworkPolicyScenario(base.BaseKuryrScenarioTest,
or not egress_cidrs_shouldnt_exist.issubset( or not egress_cidrs_shouldnt_exist.issubset(
egress_cidrs_found))): egress_cidrs_found))):
rules_match = True rules_match = True
else:
time.sleep(10) time.sleep(1)
if not rules_match: if not rules_match:
msg = 'Timed out waiting sg rules for np %s to match' % np msg = 'Timed out waiting sg rules for np %s to match' % np
raise lib_exc.TimeoutException(msg) raise lib_exc.TimeoutException(msg)