From f4db6292b355c4fa75d8a6b8be0e2bf599b58c37 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 26 Aug 2024 21:30:37 +0000 Subject: [PATCH] add smoketest-assist execution mode Signed-off-by: Jason Volk --- src/service/admin/startup.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/service/admin/startup.rs b/src/service/admin/startup.rs index 79dc70d0..8a4a3d63 100644 --- a/src/service/admin/startup.rs +++ b/src/service/admin/startup.rs @@ -1,7 +1,4 @@ - -use conduit::{ - debug, error, implement, info, -}; +use conduit::{debug, debug_info, error, implement, info}; use ruma::events::room::message::RoomMessageEventContent; use tokio::time::{sleep, Duration}; @@ -33,6 +30,16 @@ pub(super) async fn startup_execute(&self) { self.startup_execute_command(i, command.clone()).await; tokio::task::yield_now().await; } + + // The smoketest functionality is placed here for now and simply initiates + // shutdown after all commands have executed. + if self.services.server.config.test.contains("smoke") { + debug_info!("Smoketest mode. All commands complete. Shutting down now..."); + self.services + .server + .shutdown() + .unwrap_or_else(error::default_log); + } } /// Execute one admin command after startup