Skip to content

Commit

Permalink
test_ingress: fix service ip poller
Browse files Browse the repository at this point in the history
get_external_service_ip repeatedly attempts to retrieve the
specified service ip.

The problem is that it uses "is None" checks to determine if
an ip was retrieved. This returns "False" for empty strings,
so the loop exits prematurely.

Note that "is None" checks are strongly discouraged in Python.

While at it, we're bumpting the timeout as well.
  • Loading branch information
petrutlucian94 committed Jan 15, 2025
1 parent 108cbf2 commit 0250976
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/integration/tests/test_ingress.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_ingress_service_node_port(p):
def get_external_service_ip(instance: harness.Instance, service_namespace) -> str:
try_count = 0
ingress_ip = None
while ingress_ip is None and try_count < 20:
while not ingress_ip and try_count < 60:
try_count += 1
for svcns in service_namespace:
svc = svcns["service"]
Expand All @@ -64,7 +64,7 @@ def get_external_service_ip(instance: harness.Instance, service_namespace) -> st
.stdout.decode()
.replace("'", "")
)
if ingress_ip is not None:
if ingress_ip:
return ingress_ip
except subprocess.CalledProcessError:
ingress_ip = None
Expand Down

0 comments on commit 0250976

Please sign in to comment.