Skip to content

Commit

Permalink
PR changes
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGlobus committed Nov 22, 2024
1 parent 63cbaff commit 3874ea6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,9 @@ def __init__(

if not HighThroughputEngine.is_hostname_or_ip(address):
err_msg = (
f"Invalid address supplied: ({address}) "
"Please use a valid hostname or IPv4/IPv6 address"
# yes, suggesting `=` formatter, so it's clear which argument.
f"Invalid address: {address=}\n\n"
"Expecting an interface name, hostname, IPv4 address, or IPv6 address."
)
log.critical(err_msg)
raise ValueError(err_msg)
Expand Down Expand Up @@ -424,8 +425,7 @@ def start(
def is_hostname_or_ip(hostname_or_ip: str) -> bool:
"""
Utility method to verify that the input is a valid hostname or
IP address. This is potentially useful elsewhere, if used,
should we move it to another module?
IP address.
"""
if not hostname_or_ip:
return False
Expand Down
3 changes: 1 addition & 2 deletions compute_endpoint/tests/unit/test_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,5 +414,4 @@ def test_gcmpiengine_accepts_resource_specification(task_uuid, randomstring):
),
)
def test_hostname_or_ip_validation(input, is_valid):
result = HighThroughputEngine.is_hostname_or_ip(input)
assert is_valid == result
assert HighThroughputEngine.is_hostname_or_ip(input) is is_valid

0 comments on commit 3874ea6

Please sign in to comment.