Skip to content

Commit 0c72662

Browse files
committed
Fix smoketest (partial)
Signed-off-by: Mihai Criveti <[email protected]>
1 parent 6d184ad commit 0c72662

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

smoketest.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,18 @@ def step_8_invoke_tool():
314314
logging.info("✅ Tool invocation returned time")
315315

316316

317-
318317
def step_9_version_health():
319318
health = request("GET", "/health").json()["status"].lower()
320319
assert health in ("ok", "healthy"), f"Unexpected health status: {health}"
321320
ver = request("GET", "/version").json()["app"]["name"]
322321
logging.info("✅ Health OK – app %s", ver)
323322

324323

324+
def step_10_cleanup_gateway(gid: int | None = None):
325+
if gid is None:
326+
logging.warning("🧹 No gateway ID; nothing to delete")
327+
return
325328

326-
def step_10_cleanup_gateway(gid: int):
327329
request("DELETE", f"/gateways/{gid}")
328330
assert all(g["id"] != gid for g in request("GET", "/gateways").json())
329331
logging.info("✅ Gateway deleted")
@@ -388,8 +390,11 @@ def main():
388390
fn(args.restart_time_server) # type: ignore[arg-type]
389391
elif name == "register_gateway":
390392
gid = fn() # type: ignore[func-returns-value]
391-
elif name == "cleanup_gateway" and gid is not None:
392-
fn(gid) # type: ignore[arg-type]
393+
elif name == "cleanup_gateway":
394+
if gid is None:
395+
logging.warning("🧹 Skipping gateway‐deletion: no gateway was ever registered")
396+
else:
397+
fn(gid) # type: ignore[arg-type]
393398
else:
394399
fn()
395400
logging.info("\n✅✅ ALL STEPS PASSED")
@@ -401,6 +406,5 @@ def main():
401406
cleanup()
402407

403408

404-
405409
if __name__ == "__main__":
406410
main()

0 commit comments

Comments
 (0)