qa: shut down the daemon via the JSONRPC interface at teardown

This commit is contained in:
Antoine Poinsot 2022-08-10 19:04:40 +02:00
parent 726209cc0a
commit eeac67dc0a
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
2 changed files with 10 additions and 0 deletions

View File

@ -101,6 +101,7 @@ fn connection_handler(
let req_id = req.id.clone();
if &req.method == "stop" {
shutdown.store(true, atomic::Ordering::Relaxed);
log::info!("Stopping the minisafe daemon.");
}
log::trace!("JSONRPC request: {:?}", serde_json::to_string(&req));

View File

@ -1,3 +1,4 @@
import logging
import os
from test_framework.utils import (
@ -52,6 +53,14 @@ class Minisafed(TailableProc):
)
def stop(self, timeout=5):
try:
self.rpc.stop()
self.wait_for_log(
"Stopping the minisafe daemon.",
)
self.proc.wait(timeout)
except Exception as e:
logging.error(f"{self.prefix} : error when calling stop: '{e}'")
return TailableProc.stop(self)
def cleanup(self):