Add test case for Api1Range serde

This commit is contained in:
Dominik Werder
2022-11-22 16:33:48 +01:00
parent 8d205a7fa7
commit dfff79329e
20 changed files with 484 additions and 231 deletions
+7 -2
View File
@@ -1,7 +1,10 @@
use crate::spawn_test_hosts;
use err::Error;
use netpod::log::*;
use netpod::Cluster;
use std::sync::{Arc, Mutex};
use std::{thread};
use std::time::Duration;
use tokio::task::JoinHandle;
pub struct RunningHosts {
@@ -47,7 +50,7 @@ pub fn require_test_hosts_running() -> Result<Arc<RunningHosts>, Error> {
let mut g = HOSTS_RUNNING.lock().unwrap();
match g.as_ref() {
None => {
netpod::log::info!("\n\n+++++++++++++++++++ MAKE NEW RunningHosts\n\n");
info!("\n\n+++++++++++++++++++ MAKE NEW RunningHosts\n\n");
let cluster = netpod::test_cluster();
let jhs = spawn_test_hosts(cluster.clone());
let ret = RunningHosts {
@@ -56,10 +59,12 @@ pub fn require_test_hosts_running() -> Result<Arc<RunningHosts>, Error> {
};
let a = Arc::new(ret);
*g = Some(a.clone());
// TODO check in different way that test hosts are up, sockets connected, ready for testing
thread::sleep(Duration::from_millis(400));
Ok(a)
}
Some(gg) => {
netpod::log::debug!("\n\n+++++++++++++++++++ REUSE RunningHost\n\n");
debug!("\n\n+++++++++++++++++++ REUSE RunningHost\n\n");
Ok(gg.clone())
}
}