Use a common set of running nodes for tests
This commit is contained in:
3
disk/src/cache/pbv.rs
vendored
3
disk/src/cache/pbv.rs
vendored
@@ -376,6 +376,7 @@ where
|
||||
continue 'outer;
|
||||
}
|
||||
Err(e) => match e.kind() {
|
||||
// TODO other error kinds
|
||||
std::io::ErrorKind::NotFound => match self.try_setup_fetch_prebinned_higher_res() {
|
||||
Ok(_) => {
|
||||
if self.fut2.is_none() {
|
||||
@@ -398,7 +399,7 @@ where
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
error!("File I/O error: {:?}", e);
|
||||
error!("File I/O error: kind {:?} {:?}\n\n..............", e.kind(), e);
|
||||
self.errored = true;
|
||||
Ready(Some(Err(e.into())))
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
chrono = "0.4"
|
||||
clap = "3.0.0-beta.2"
|
||||
lazy_static = "1.4.0"
|
||||
err = { path = "../err" }
|
||||
taskrun = { path = "../taskrun" }
|
||||
netpod = { path = "../netpod" }
|
||||
|
||||
@@ -15,10 +15,39 @@ use hyper::Body;
|
||||
use netpod::log::*;
|
||||
use netpod::{AggKind, Channel, Cluster, Database, HostPort, NanoRange, Node, PerfOpts};
|
||||
use std::future::ready;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use tokio::io::AsyncRead;
|
||||
use tokio::task::JoinHandle;
|
||||
|
||||
pub mod json;
|
||||
|
||||
struct RunningHosts {
|
||||
cluster: Cluster,
|
||||
_jhs: Vec<JoinHandle<Result<(), Error>>>,
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
static ref HOSTS_RUNNING: Mutex<Option<Arc<RunningHosts>>> = Mutex::new(None);
|
||||
}
|
||||
|
||||
fn require_test_hosts_running() -> Result<Arc<RunningHosts>, Error> {
|
||||
let mut g = HOSTS_RUNNING.lock().unwrap();
|
||||
match g.as_ref() {
|
||||
None => {
|
||||
let cluster = test_cluster();
|
||||
let jhs = spawn_test_hosts(cluster.clone());
|
||||
let ret = RunningHosts {
|
||||
cluster: cluster.clone(),
|
||||
_jhs: jhs,
|
||||
};
|
||||
let a = Arc::new(ret);
|
||||
*g = Some(a.clone());
|
||||
Ok(a)
|
||||
}
|
||||
Some(gg) => Ok(gg.clone()),
|
||||
}
|
||||
}
|
||||
|
||||
fn test_cluster() -> Cluster {
|
||||
let nodes = (0..3)
|
||||
.into_iter()
|
||||
@@ -50,15 +79,15 @@ fn get_binned_binary() {
|
||||
}
|
||||
|
||||
async fn get_binned_binary_inner() -> Result<(), Error> {
|
||||
let cluster = test_cluster();
|
||||
let _hosts = spawn_test_hosts(cluster.clone());
|
||||
let rh = require_test_hosts_running()?;
|
||||
let cluster = &rh.cluster;
|
||||
if true {
|
||||
get_binned_channel(
|
||||
"wave-f64-be-n21",
|
||||
"1970-01-01T00:20:10.000Z",
|
||||
"1970-01-01T00:20:30.000Z",
|
||||
2,
|
||||
&cluster,
|
||||
cluster,
|
||||
true,
|
||||
2,
|
||||
)
|
||||
@@ -70,7 +99,7 @@ async fn get_binned_binary_inner() -> Result<(), Error> {
|
||||
"1970-01-01T01:11:00.000Z",
|
||||
"1970-01-01T01:35:00.000Z",
|
||||
7,
|
||||
&cluster,
|
||||
cluster,
|
||||
true,
|
||||
24,
|
||||
)
|
||||
@@ -82,7 +111,7 @@ async fn get_binned_binary_inner() -> Result<(), Error> {
|
||||
"1970-01-01T01:42:00.000Z",
|
||||
"1970-01-01T03:55:00.000Z",
|
||||
2,
|
||||
&cluster,
|
||||
cluster,
|
||||
true,
|
||||
3,
|
||||
)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::spawn_test_hosts;
|
||||
use crate::test::test_cluster;
|
||||
use crate::test::require_test_hosts_running;
|
||||
use chrono::{DateTime, Utc};
|
||||
use disk::cache::BinnedQuery;
|
||||
use err::Error;
|
||||
@@ -14,14 +13,14 @@ fn get_binned_json_0() {
|
||||
}
|
||||
|
||||
async fn get_binned_json_0_inner() -> Result<(), Error> {
|
||||
let cluster = test_cluster();
|
||||
let _hosts = spawn_test_hosts(cluster.clone());
|
||||
let rh = require_test_hosts_running()?;
|
||||
let cluster = &rh.cluster;
|
||||
get_binned_json_0_inner2(
|
||||
"wave-f64-be-n21",
|
||||
"1970-01-01T00:20:10.000Z",
|
||||
"1970-01-01T01:20:30.000Z",
|
||||
10,
|
||||
&cluster,
|
||||
cluster,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user