Skip to content

Commit

Permalink
Tests failed because of some new binding with IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
awicenec committed Oct 14, 2022
1 parent 25fab6e commit 0f2dc3f
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 38 deletions.
2 changes: 1 addition & 1 deletion OpenAPI/tests/managers_test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
print("sessions in DIM: %r" % (dim.get_sessions(),))
nodes = dim.get_cm_nodes()
print(nodes)
if "127.0.0.1" not in nodes:
if "localhost" not in nodes:
raise ValueError()
2 changes: 1 addition & 1 deletion OpenAPI/tests/translator_test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
print(html_content)
html_content = translator.gen_pg(
pgt_id="test",
dlg_mgr_host="127.0.0.1",
dlg_mgr_host="localhost",
dlg_mgr_port=8001,
dlg_mgr_deploy="deploy",
)
7 changes: 4 additions & 3 deletions daliuge-common/dlg/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

quote = urllib.parse.quote

default_host = "localhost" # localhost now binds to IPv6 address on some distros

class BaseDROPManagerClient(RestClient):
"""
Expand Down Expand Up @@ -222,7 +223,7 @@ class NodeManagerClient(BaseDROPManagerClient):
"""

def __init__(
self, host="localhost", port=constants.NODE_DEFAULT_REST_PORT, timeout=10
self, host=default_host, port=constants.NODE_DEFAULT_REST_PORT, timeout=10
):
super(NodeManagerClient, self).__init__(host=host, port=port, timeout=timeout)

Expand Down Expand Up @@ -258,7 +259,7 @@ class DataIslandManagerClient(CompositeManagerClient):
"""

def __init__(
self, host="localhost", port=constants.ISLAND_DEFAULT_REST_PORT, timeout=10
self, host=default_host, port=constants.ISLAND_DEFAULT_REST_PORT, timeout=10
):
super(DataIslandManagerClient, self).__init__(
host=host, port=port, timeout=timeout
Expand All @@ -271,7 +272,7 @@ class MasterManagerClient(CompositeManagerClient):
"""

def __init__(
self, host="localhost", port=constants.MASTER_DEFAULT_REST_PORT, timeout=10
self, host=default_host, port=constants.MASTER_DEFAULT_REST_PORT, timeout=10
):
super(MasterManagerClient, self).__init__(host=host, port=port, timeout=timeout)

Expand Down
2 changes: 1 addition & 1 deletion daliuge-common/dlg/restutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def log_message(self, fmt, *args):


class RestServerWSGIServer:
def __init__(self, wsgi_app, listen="127.0.0.1", port=8080):
def __init__(self, wsgi_app, listen="localhost", port=8080):
self.wsgi_app = wsgi_app
self.listen = listen
self.port = port
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/apps/socket_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class SocketListenerApp(BarrierAppDROP):
[dlg_streaming_input("binary/*")],
)

host = dlg_string_param("host", "127.0.0.1")
host = dlg_string_param("host", "localhost")
port = dlg_int_param("port", 1111)
bufsize = dlg_int_param("bufsize", 4096)
reuseAddr = dlg_bool_param("reuseAddr", False)
Expand Down
4 changes: 2 additions & 2 deletions daliuge-engine/dlg/dask_emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ResultTransmitter(BarrierAppDROP):

def initialize(self, **kwargs):
BarrierAppDROP.initialize(self, input_error_threshold=100, **kwargs)
self.host = self._popArg(kwargs, "host", "127.0.0.1")
self.host = self._popArg(kwargs, "host", "localhost")
self.port = self._popArg(kwargs, "port", None)
if self.port is None:
raise InvalidDropException(self, "Missing port parameter")
Expand Down Expand Up @@ -81,7 +81,7 @@ def _get_client(**kwargs):
from .manager.client import NodeManagerClient
from .manager import constants

host = kwargs.get("host", "127.0.0.1")
host = kwargs.get("host", "localhost")
port = kwargs.get("port", constants.NODE_DEFAULT_REST_PORT)
timeout = kwargs.get("timeout", None)
return NodeManagerClient(host, port, timeout)
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/data/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def IOForURL(url):
filename = url.path
if (
hostname == "localhost"
or hostname == "127.0.0.1"
or hostname == "localhost"
or hostname == os.uname()[1]
):
io = FileIO(filename)
Expand Down
8 changes: 4 additions & 4 deletions daliuge-engine/dlg/deploy/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _session_finished(session):
def monitor_sessions(
session_id=None,
poll_interval=10,
host="127.0.0.1",
host="localhost",
port=constants.ISLAND_DEFAULT_REST_PORT,
timeout=30,
status_dump_path=None,
Expand Down Expand Up @@ -127,7 +127,7 @@ def monitor_sessions(
def monitor_sessions_repro(
session_id=None,
poll_interval=10,
host="127.0.0.1",
host="localhost",
port=constants.ISLAND_DEFAULT_REST_PORT,
timeout=60,
status_dump_path=None,
Expand All @@ -154,7 +154,7 @@ def monitor_sessions_repro(
def fetch_reproducibility(
session_id=None,
poll_interval=10,
host="127.0.0.1",
host="localhost",
port=constants.ISLAND_DEFAULT_REST_PORT,
timeout=60,
):
Expand All @@ -173,7 +173,7 @@ def fetch_reproducibility(

def submit(
pg,
host="127.0.0.1",
host="localhost",
port=constants.ISLAND_DEFAULT_REST_PORT,
timeout=30,
skip_deploy=False,
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/manager/node_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def __init__(
*args,
**kwargs
):
host = host or "127.0.0.1"
host = host or "localhost"
NodeManagerBase.__init__(self, *args, **kwargs)
EventMixIn.__init__(self, host, events_port)
RpcMixIn.__init__(self, host, rpc_port)
Expand Down
8 changes: 4 additions & 4 deletions daliuge-engine/dlg/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ def _start_manager_in_thread(
):
manager = manager_class(*manager_args, **manager_kwargs)
server = rest_class(manager)
thread = threading.Thread(target=server.start, args=("127.0.0.1", port))
thread = threading.Thread(target=server.start, args=("localhost", port))
thread.start()
self.assertTrue(portIsOpen("127.0.0.1", port, 5))
self.assertTrue(portIsOpen("localhost", port, 5))
return ManagerInfo(manager, server, thread, self)

def start_nm_in_thread(self, port=constants.NODE_DEFAULT_REST_PORT):
return self._start_manager_in_thread(port, NodeManager, NMRestServer, False)

def start_dim_in_thread(
self, nm_hosts=["127.0.0.1"], port=constants.ISLAND_DEFAULT_REST_PORT
self, nm_hosts=["localhost"], port=constants.ISLAND_DEFAULT_REST_PORT
):
return self._start_manager_in_thread(
port, DataIslandManager, CompositeManagerRestServer, nm_hosts
)

def start_mm_in_thread(
self, nm_hosts=["127.0.0.1"], port=constants.MASTER_DEFAULT_REST_PORT
self, nm_hosts=["localhost"], port=constants.MASTER_DEFAULT_REST_PORT
):
return self._start_manager_in_thread(
port, MasterManager, CompositeManagerRestServer, nm_hosts
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def to_externally_contactable_host(host, prefer_local=False):
# if only one interface is found we assume it's a loopback interface
addresses = get_all_ipv4_addresses()
if prefer_local or len(addresses) == 1:
return "127.0.0.1"
return "localhost"

# Choose the first non-127.0.0.1 one
for a in addresses:
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/test/apps/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _test_socket_listener(self, **kwargs):
A --> B --> C --> D
"""

host = "127.0.0.1"
host = "localhost"
port = 9933
data = os.urandom(1025)

Expand Down
6 changes: 3 additions & 3 deletions daliuge-engine/test/deploy/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def _submit(self):
]
pg = add_test_reprodata(pg)
for drop in pg:
drop["node"] = "127.0.0.1"
drop["island"] = "127.0.0.1"
return common.submit(pg, "127.0.0.1", self.port)
drop["node"] = "localhost"
drop["island"] = "localhost"
return common.submit(pg, "localhost", self.port)

def assert_sessions_finished(self, status, *session_ids):
for session_id in session_ids:
Expand Down
16 changes: 8 additions & 8 deletions daliuge-engine/test/deploy/test_helm_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def test_create_single_node_helm_chart(self):
{"oid": "C", "type": "plain", "storage": Categories.MEMORY},
]
for drop in pg:
drop["node"] = "127.0.0.1"
drop["island"] = "127.0.0.1"
drop["node"] = "localhost"
drop["island"] = "localhost"
with tempfile.TemporaryDirectory() as tmp_dir:
helm_client = HelmClient(deploy_dir=tmp_dir, deploy_name="dlg-test")
helm_client.create_helm_chart(json.dumps(pg), co_host=False)
Expand All @@ -81,17 +81,17 @@ def test_create_multi_node_helm_chart(self):
"oid": "A",
"type": "plain",
"storage": Categories.MEMORY,
"node": "127.0.0.1",
"island": "127.0.0.1",
"node": "localhost",
"island": "localhost",
},
{
"oid": "B",
"type": "app",
"app": "dlg.apps.simple.SleepApp",
"inputs": ["A"],
"outputs": ["C"],
"node": "127.0.0.1",
"island": "127.0.0.1",
"node": "localhost",
"island": "localhost",
},
{
"oid": "D",
Expand All @@ -106,8 +106,8 @@ def test_create_multi_node_helm_chart(self):
"oid": "C",
"type": "plain",
"storage": Categories.MEMORY,
"node": "127.0.0.1",
"island": "127.0.0.1",
"node": "localhost",
"island": "localhost",
},
{
"oid": "E",
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/test/manager/test_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from dlg.exceptions import NoSessionException
from test.manager import testutils

hostname = "127.0.0.1"
hostname = "localhost"

default_repro = {
"rmode": "1",
Expand Down
2 changes: 1 addition & 1 deletion daliuge-translator/dlg/dropmake/web/lg_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def gen_pg_spec():
node_list = request.json.get("node_list")
manager_host = request.json.get("manager_host")
if manager_host == "localhost":
manager_host = "127.0.0.1"
manager_host = "localhost"
# try:
# manager_port = int(request.json.get("manager_port"));
# except:
Expand Down
2 changes: 1 addition & 1 deletion daliuge-translator/dlg/dropmake/web/translator_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def gen_pg_spec(
"""
try:
if manager_host == "localhost":
manager_host = "127.0.0.1"
manager_host = "localhost"
logger.debug("pgt_id: %s", str(pgt_id))
logger.debug("node_list: %s", str(node_list))
except Exception as ex:
Expand Down
6 changes: 3 additions & 3 deletions daliuge-translator/test/dropmake/test_lgweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def setUp(self):
"-p",
str(lgweb_port),
"-H",
"localhost",
"127.0.0.1",
]
self.devnull = open(os.devnull, "wb")
self.web_proc = tool.start_process(
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_post_lgjson(self):

def test_gen_pgt(self):

c = RestClient("127.0.0.1", lgweb_port, timeout=10)
c = RestClient("localhost", lgweb_port, timeout=10)

# doesn't exist!
self.assertRaises(
Expand Down Expand Up @@ -443,7 +443,7 @@ def test_pgt_map(self):

request_tests = [
(None, True), # Call with an empty form should cause an error
({"pgt_content": pgt, "nodes": "127.0.0.1", "num_islands": 1, "co_host_dim": True}, False), # Simple partition
({"pgt_content": pgt, "nodes": "localhost", "num_islands": 1, "co_host_dim": True}, False), # Simple partition
]

for request in request_tests:
Expand Down

0 comments on commit 0f2dc3f

Please sign in to comment.