Add json retrieve test for archiver appliance

This commit is contained in:
Dominik Werder
2022-02-17 16:19:39 +01:00
parent 47acaa68a0
commit c6dba54a62
8 changed files with 201 additions and 14 deletions

View File

@@ -26,9 +26,21 @@ impl Drop for RunningSlsHost {
}
}
pub struct RunningArchappHost {
pub cluster: Cluster,
_jhs: Vec<JoinHandle<Result<(), Error>>>,
}
impl Drop for RunningArchappHost {
fn drop(&mut self) {
netpod::log::info!("\n\n+++++++++++++++++++ impl Drop for RunningArchappHost\n\n");
}
}
lazy_static::lazy_static! {
static ref HOSTS_RUNNING: Mutex<Option<Arc<RunningHosts>>> = Mutex::new(None);
static ref SLS_HOST_RUNNING: Mutex<Option<Arc<RunningSlsHost>>> = Mutex::new(None);
static ref ARCHAPP_HOST_RUNNING: Mutex<Option<Arc<RunningArchappHost>>> = Mutex::new(None);
}
pub fn require_test_hosts_running() -> Result<Arc<RunningHosts>, Error> {
@@ -74,3 +86,25 @@ pub fn require_sls_test_host_running() -> Result<Arc<RunningSlsHost>, Error> {
}
}
}
pub fn require_archapp_test_host_running() -> Result<Arc<RunningArchappHost>, Error> {
let mut g = ARCHAPP_HOST_RUNNING.lock().unwrap();
match g.as_ref() {
None => {
netpod::log::info!("\n\n+++++++++++++++++++ MAKE NEW RunningArchappHost\n\n");
let cluster = netpod::archapp_test_cluster();
let jhs = spawn_test_hosts(cluster.clone());
let ret = RunningArchappHost {
cluster: cluster.clone(),
_jhs: jhs,
};
let a = Arc::new(ret);
*g = Some(a.clone());
Ok(a)
}
Some(gg) => {
netpod::log::debug!("\n\n+++++++++++++++++++ REUSE RunningArchappHost\n\n");
Ok(gg.clone())
}
}
}