Services and entites now have correct url to emulated servers
All checks were successful
checks-impure / test (pull_request) Successful in 26s
checks / test (pull_request) Successful in 1m11s

This commit is contained in:
2024-01-15 18:08:31 +01:00
parent eb5eb1613f
commit f46ed02435
4 changed files with 46 additions and 13 deletions

View File

@@ -1,8 +1,10 @@
host = "127.0.0.1" host = "127.0.0.1"
port_dlg = 7000 port_dlg = 7000
port_ap = 7500 port_ap = 7500
port_client_base = 8000 _port_client_base = 8000
c1_port = _port_client_base + 1
c2_port = _port_client_base + 2
dlg_url = f"http://{host}:{port_dlg}/docs" dlg_url = f"http://{host}:{port_dlg}/docs"
ap_url = f"http://{host}:{port_ap}/docs" ap_url = f"http://{host}:{port_ap}/docs"
c1_url = f"http://{host}:{port_client_base}/docs" c1_url = f"http://{host}:{c1_port}/docs"
c2_url = f"http://{host}:{port_client_base + 1}/docs" c2_url = f"http://{host}:{c2_port}/docs"

View File

@@ -17,8 +17,8 @@ app_c2 = FastAPI(swagger_ui_parameters={"tryItOutEnabled": True})
apps = [ apps = [
(app_dlg, config.port_dlg), (app_dlg, config.port_dlg),
(app_ap, config.port_ap), (app_ap, config.port_ap),
(app_c1, config.port_client_base), (app_c1, config.c1_port),
(app_c2, config.port_client_base + 1), (app_c2, config.c2_port),
] ]
@@ -79,7 +79,7 @@ def get_health(*, url: str, max_retries: int = 20, delay: float = 0.2) -> str |
# TODO send_msg??? # TODO send_msg???
@app_c1.get("/consume_service_from_other_entity", response_class=HTMLResponse) @app_c1.get("/v1/print_daemon1", response_class=HTMLResponse)
async def consume_service_from_other_entity_c1() -> HTMLResponse: async def consume_service_from_other_entity_c1() -> HTMLResponse:
html_content = """ html_content = """
<html> <html>
@@ -92,7 +92,17 @@ async def consume_service_from_other_entity_c1() -> HTMLResponse:
return HTMLResponse(content=html_content, status_code=200) return HTMLResponse(content=html_content, status_code=200)
@app_c2.get("/consume_service_from_other_entity", response_class=HTMLResponse) @app_c1.get("/v1/print_daemon1/register", response_class=JSONResponse)
async def register_c1() -> JSONResponse:
return JSONResponse(content={"status": "registered"}, status_code=200)
@app_c1.get("/v1/print_daemon1/deregister", response_class=JSONResponse)
async def deregister_c1() -> JSONResponse:
return JSONResponse(content={"status": "deregistered"}, status_code=200)
@app_c2.get("/v1/print_daemon2", response_class=HTMLResponse)
async def consume_service_from_other_entity_c2() -> HTMLResponse: async def consume_service_from_other_entity_c2() -> HTMLResponse:
html_content = """ html_content = """
<html> <html>
@@ -105,6 +115,16 @@ async def consume_service_from_other_entity_c2() -> HTMLResponse:
return HTMLResponse(content=html_content, status_code=200) return HTMLResponse(content=html_content, status_code=200)
@app_c2.get("/v1/print_daemon1/register", response_class=JSONResponse)
async def register_c2() -> JSONResponse:
return JSONResponse(content={"status": "registered"}, status_code=200)
@app_c2.get("/v1/print_daemon1/deregister", response_class=JSONResponse)
async def deregister_c2() -> JSONResponse:
return JSONResponse(content={"status": "deregistered"}, status_code=200)
@app_ap.get("/ap_list_of_services", response_class=JSONResponse) @app_ap.get("/ap_list_of_services", response_class=JSONResponse)
async def ap_list_of_services() -> JSONResponse: async def ap_list_of_services() -> JSONResponse:
res = [ res = [

View File

@@ -26,7 +26,7 @@ random.seed(42)
host = config.host host = config.host
port_dlg = config.port_dlg port_dlg = config.port_dlg
port_ap = config.port_ap port_ap = config.port_ap
port_client_base = config.port_client_base port_client_base = config._port_client_base
num_uuids = 100 num_uuids = 100
uuids = [str(uuid.UUID(int=random.getrandbits(128))) for i in range(num_uuids)] uuids = [str(uuid.UUID(int=random.getrandbits(128))) for i in range(num_uuids)]
@@ -38,7 +38,7 @@ def test_health(api_client: ApiClient) -> None:
assert res.status == Status.ONLINE assert res.status == Status.ONLINE
def create_entities(num: int = 10, role: str = "entity") -> list[EntityCreate]: def create_entities(num: int = 5, role: str = "entity") -> list[EntityCreate]:
res = [] res = []
for i in range(num): for i in range(num):
en = EntityCreate( en = EntityCreate(
@@ -108,10 +108,9 @@ def test_create_services(api_client: ApiClient) -> None:
sapi = ServicesApi(api_client=api_client) sapi = ServicesApi(api_client=api_client)
eapi = EntitiesApi(api_client=api_client) eapi = EntitiesApi(api_client=api_client)
for midx, entity in enumerate(eapi.get_all_entities()): for midx, entity in enumerate(eapi.get_all_entities()):
for idx in range(4): service_obj = create_service(midx, entity)
service_obj = create_service(idx + 4 * midx, entity) service = sapi.create_service(service_obj)
service = sapi.create_service(service_obj) assert service.uuid == service_obj.uuid
assert service.uuid == service_obj.uuid
random.seed(77) random.seed(77)

View File

@@ -45,6 +45,18 @@ const menuEntityEntries: MenuEntry[] = [
to: "/client/C2", to: "/client/C2",
disabled: false, disabled: false,
}, },
{
icon: <PersonIcon />,
label: "C3",
to: "/client/C3",
disabled: false,
},
{
icon: <PersonIcon />,
label: "C4",
to: "/client/C4",
disabled: false,
},
]; ];
const menuEntries: MenuEntry[] = [ const menuEntries: MenuEntry[] = [