From bb13be4203a7e2b3922f033c296dfdc8a2808e85 Mon Sep 17 00:00:00 2001 From: khoaguin Date: Fri, 27 Sep 2024 10:48:17 +0700 Subject: [PATCH] [tests/scenarios] always print side-type after "Admin" in logs --- tests/scenariosv2/flows/admin_bigquery_api.py | 2 +- tests/scenariosv2/flows/admin_bigquery_pool.py | 5 ++++- tests/scenariosv2/flows/admin_common.py | 2 +- tests/scenariosv2/l0_test.py | 12 ++++++------ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/scenariosv2/flows/admin_bigquery_api.py b/tests/scenariosv2/flows/admin_bigquery_api.py index 7ae68383a8b..aff811d4199 100644 --- a/tests/scenariosv2/flows/admin_bigquery_api.py +++ b/tests/scenariosv2/flows/admin_bigquery_api.py @@ -120,7 +120,7 @@ def __create_endpoint( endpoint: Any, path: str, ): - msg = f"Admin: Endpoint '{path}' on {server_info(admin_client)}" + msg = f"Admin {admin_client.metadata.server_side_type}: Endpoint '{path}' on {server_info(admin_client)}" ctx.logger.info(f"{msg} - Creating") # Create the endpoint diff --git a/tests/scenariosv2/flows/admin_bigquery_pool.py b/tests/scenariosv2/flows/admin_bigquery_pool.py index 6dbba7e6702..6f42d6a72b2 100644 --- a/tests/scenariosv2/flows/admin_bigquery_pool.py +++ b/tests/scenariosv2/flows/admin_bigquery_pool.py @@ -27,7 +27,10 @@ def bq_create_pool( f"RUN uv pip install db-dtypes google-cloud-bigquery" ) - msg = f"Admin: Worker Pool tag '{worker_image_tag}' on {server_info(admin_client)}" + msg = ( + f"Admin {admin_client.metadata.server_side_type}: " + f"Worker Pool tag '{worker_image_tag}' on {server_info(admin_client)}" + ) ctx.logger.info(f"{msg} - Creating") build_and_launch_worker_pool_from_docker_str( diff --git a/tests/scenariosv2/flows/admin_common.py b/tests/scenariosv2/flows/admin_common.py index fc03a123cb3..2e8454ff1f7 100644 --- a/tests/scenariosv2/flows/admin_common.py +++ b/tests/scenariosv2/flows/admin_common.py @@ -9,7 +9,7 @@ def register_user(ctx: SimulatorContext, admin_client: sy.DatasiteClient, user: dict): - msg = f"Admin: User {user['email']} on {server_info(admin_client)}" + msg = f"Admin {admin_client.metadata.server_side_type}: User {user['email']} on {server_info(admin_client)}" ctx.logger.info(f"{msg} - Creating") _ = admin_client.register( name=user["name"], diff --git a/tests/scenariosv2/l0_test.py b/tests/scenariosv2/l0_test.py index c53b85f055f..7aa086b043c 100644 --- a/tests/scenariosv2/l0_test.py +++ b/tests/scenariosv2/l0_test.py @@ -262,7 +262,7 @@ async def admin_high_triage_requests( @sim_activity(trigger=Event.ADMIN_HIGHSIDE_FLOW_COMPLETED) async def admin_high_side_flow(ctx: SimulatorContext, admin_auth): admin_client = sy.login(**admin_auth) - ctx.logger.info("Admin high-side: logged in") + ctx.logger.info("Admin high: logged in") await asyncio.gather( admin_high_create_bq_pool(ctx, admin_client), @@ -274,7 +274,7 @@ async def admin_high_side_flow(ctx: SimulatorContext, admin_auth): @sim_activity(trigger=Event.ADMIN_LOWSIDE_FLOW_COMPLETED) async def admin_low_side_flow(ctx: SimulatorContext, admin_auth, users): admin_client = sy.login(**admin_auth) - ctx.logger.info("Admin low-side: logged in") + ctx.logger.info("Admin low: logged in") await asyncio.gather( admin_register_users(ctx, admin_client, users), @@ -302,19 +302,19 @@ async def admin_sync( while not ctx.events.is_set(exit_after): await asyncio.sleep(random.uniform(5, 10)) - ctx.logger.info(f"Admin: Sync {from_}->{to_} - Checking") + ctx.logger.info(f"Admin {from_}: Sync {from_}->{to_} - Checking") result = sy.sync(from_client, to_client) if isinstance(result, sy.SyftSuccess): continue - ctx.logger.info(f"Admin: Sync {from_}->{to_} - Result={result}") + ctx.logger.info(f"Admin {from_}: Sync {from_}->{to_} - Result={result}") result._share_all() result._sync_all() ctx.events.trigger(trigger) - ctx.logger.info(f"Admin: Sync {from_}->{to_} - Synced") + ctx.logger.info(f"Admin {from_}: Sync {from_}->{to_} - Synced") - ctx.logger.info(f"Admin: Sync {from_}->{to_} - Closed") + ctx.logger.info(f"Admin {from_}: Sync {from_}->{to_} - Closed") @sim_activity(trigger=Event.ADMIN_SYNC_COMPLETED)