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