From ab919f48af3a03d534094fd6116337084c75ddfb Mon Sep 17 00:00:00 2001 From: Petteri Stenius Date: Mon, 6 Nov 2023 11:21:30 +0200 Subject: [PATCH 1/3] improve accept error message see also https://github.com/WebOfTrust/keripy/issues/455 --- src/keria/app/agenting.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/keria/app/agenting.py b/src/keria/app/agenting.py index 50942798..c4342a5f 100644 --- a/src/keria/app/agenting.py +++ b/src/keria/app/agenting.py @@ -59,6 +59,8 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No 'signify-resource', 'signify-timestamp'])) bootServer = createHttpServer(bootPort, bootApp, keypath, certpath, cafilepath) + if not bootServer.reopen(): + raise RuntimeError(f"cannot create boot http server on port {bootPort}") bootServerDoer = http.ServerDoer(server=bootServer) bootEnd = BootEnd(agency) bootApp.add_route("/boot", bootEnd) @@ -77,6 +79,8 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No app.resp_options.media_handlers.update(media.Handlers()) adminServer = createHttpServer(adminPort, app, keypath, certpath, cafilepath) + if not adminServer.reopen(): + raise RuntimeError(f"cannot create admin http server on port {adminPort}") adminServerDoer = http.ServerDoer(server=adminServer) doers = [agency, bootServerDoer, adminServerDoer] @@ -101,6 +105,8 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No indirecting.loadEnds(agency=agency, app=happ) server = createHttpServer(httpPort, happ, keypath, certpath, cafilepath) + if not server.reopen(): + raise RuntimeError(f"cannot create local http server on port {httpPort}") httpServerDoer = http.ServerDoer(server=server) doers.append(httpServerDoer) From 8b6567a48b34a1e6650194418f4a28c953f02fd2 Mon Sep 17 00:00:00 2001 From: Petteri Stenius Date: Mon, 6 Nov 2023 11:21:30 +0200 Subject: [PATCH 2/3] improve accept error message see also https://github.com/WebOfTrust/keripy/issues/455 --- src/keria/app/agenting.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/keria/app/agenting.py b/src/keria/app/agenting.py index 3cbb9189..adb366c3 100644 --- a/src/keria/app/agenting.py +++ b/src/keria/app/agenting.py @@ -59,6 +59,8 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No 'signify-resource', 'signify-timestamp'])) bootServer = createHttpServer(bootPort, bootApp, keypath, certpath, cafilepath) + if not bootServer.reopen(): + raise RuntimeError(f"cannot create boot http server on port {bootPort}") bootServerDoer = http.ServerDoer(server=bootServer) bootEnd = BootEnd(agency) bootApp.add_route("/boot", bootEnd) @@ -77,6 +79,8 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No app.resp_options.media_handlers.update(media.Handlers()) adminServer = createHttpServer(adminPort, app, keypath, certpath, cafilepath) + if not adminServer.reopen(): + raise RuntimeError(f"cannot create admin http server on port {adminPort}") adminServerDoer = http.ServerDoer(server=adminServer) doers = [agency, bootServerDoer, adminServerDoer] @@ -100,6 +104,8 @@ def setup(name, bran, adminPort, bootPort, base='', httpPort=None, configFile=No indirecting.loadEnds(agency=agency, app=happ) server = createHttpServer(httpPort, happ, keypath, certpath, cafilepath) + if not server.reopen(): + raise RuntimeError(f"cannot create local http server on port {httpPort}") httpServerDoer = http.ServerDoer(server=server) doers.append(httpServerDoer) From d757f40a26fae2e36222f34ff96351eb18c89bac Mon Sep 17 00:00:00 2001 From: Petteri Stenius Date: Wed, 22 Nov 2023 16:56:51 +0200 Subject: [PATCH 3/3] split single test in two, the first agenting.setup was blocking the second --- tests/app/test_agenting.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/app/test_agenting.py b/tests/app/test_agenting.py index 71612bf1..4eaf9cee 100644 --- a/tests/app/test_agenting.py +++ b/tests/app/test_agenting.py @@ -28,11 +28,12 @@ from keria.core import longrunning -def test_setup(): +def test_setup_no_http(): doers = agenting.setup(name="test", bran=None, adminPort=1234, bootPort=5678) assert len(doers) == 3 assert isinstance(doers[0], agenting.Agency) is True +def test_setup(): doers = agenting.setup("test", bran=None, adminPort=1234, bootPort=5678, httpPort=9999) assert len(doers) == 4