Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Remove unnecessary library from tests #2925

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion perf-tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 12 additions & 6 deletions tests/suite/test_transport_server_udp_load_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
Expand Down