From 2262e3697174ce1ce7c056ba5607be64c2e35780 Mon Sep 17 00:00:00 2001 From: Ciara Stacke Date: Fri, 12 Aug 2022 10:20:13 +0100 Subject: [PATCH] Remove unnecessary library from testswq --- perf-tests/requirements.txt | 1 - tests/requirements.txt | 1 - .../test_transport_server_udp_load_balance.py | 18 ++++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/perf-tests/requirements.txt b/perf-tests/requirements.txt index 6ccd554ea9..0484cdad6a 100644 --- a/perf-tests/requirements.txt +++ b/perf-tests/requirements.txt @@ -2,7 +2,6 @@ PyYAML==6.0 requests==2.28.1 kubernetes==24.2.0 pytest==7.1.2 -ipaddress==1.0.23 # >= 1.0.17 cffi==1.15.1 certifi==2022.6.15 urllib3==1.26.11 diff --git a/tests/requirements.txt b/tests/requirements.txt index 5c2d21ce25..fbf20863e9 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -3,7 +3,6 @@ requests==2.28.1 forcediphttpsadapter==1.0.2 kubernetes==24.2.0 pytest==7.1.2 -ipaddress==1.0.23 # >= 1.0.17 cffi==1.15.1 pyOpenSSL==22.0.0 certifi==2022.6.15 diff --git a/tests/suite/test_transport_server_udp_load_balance.py b/tests/suite/test_transport_server_udp_load_balance.py index 44a255e1fb..a07adc99f5 100644 --- a/tests/suite/test_transport_server_udp_load_balance.py +++ b/tests/suite/test_transport_server_udp_load_balance.py @@ -25,7 +25,10 @@ def chk_endpoint(endp): endpoint. Otherwise, return unmodified endpoint. """ ip = endp[:endp.rfind(":")] - address = ipaddress.ip_address(ip) + try: + address = ipaddress.ip_address(ip) + except ValueError: + return endp if address.version == 6: port = endp[endp.rfind(":"):] return f"[{ip}]{port}" @@ -37,11 +40,14 @@ def ipfamily_from_host(host): Return socket type (AF_INET or AF_INET6) based on IP address type from host """ - address = ipaddress.ip_address(host) - if address.version == 6: - return socket.AF_INET6 - else: - return socket.AF_INET + sock = socket.AF_INET + try: + address = ipaddress.ip_address(host) + if address.version == 6: + sock = socket.AF_INET6 + except ValueError: + pass + return sock @pytest.mark.ts @pytest.mark.skip_for_loadbalancer