From c26388682990c93830194579db756ffa2b4791ed Mon Sep 17 00:00:00 2001 From: James Pace Date: Sun, 21 Dec 2025 10:18:35 -0500 Subject: [PATCH] Run some tests. --- am_i_up/client.py | 25 +++++++++++++++++++++++++ am_i_up/server.py | 1 + 2 files changed, 26 insertions(+) diff --git a/am_i_up/client.py b/am_i_up/client.py index f681958..8a1179d 100644 --- a/am_i_up/client.py +++ b/am_i_up/client.py @@ -26,6 +26,12 @@ def main(args=None): if action == 'ping': asyncio.run(call_ping(options)) + if action == 'uptime': + asyncio.run(call_uptime()) + if action == 'build_info': + asyncio.run(call_build_info()) + if action == 'env': + asyncio.run(call_env()) async def call_ping(options): if len(options) != 1 or options[0] == "": @@ -39,4 +45,23 @@ async def call_ping(options): async with session.get('http://localhost:8080/ping', json=request) as resp: print(await resp.text()) +async def call_uptime(): + print("Calling uptime.") + async with aiohttp.ClientSession() as session: + async with session.get('http://localhost:8080/uptime') as resp: + print(await resp.text()) + +async def call_build_info(): + print("Calling build_info.") + + async with aiohttp.ClientSession() as session: + async with session.get('http://localhost:8080/build_info') as resp: + print(await resp.text()) + +async def call_env(): + print("Calling env.") + + async with aiohttp.ClientSession() as session: + async with session.get('http://localhost:8080/env') as resp: + print(await resp.text()) diff --git a/am_i_up/server.py b/am_i_up/server.py index e1038ee..78f39f9 100644 --- a/am_i_up/server.py +++ b/am_i_up/server.py @@ -14,6 +14,7 @@ from ament_index_python import get_package_share_directory import yaml import ipaddress import subprocess +import os def main(): facts = Facts()