This commit is contained in:
Dominik Werder
2021-04-27 11:41:33 +02:00
parent bd9c231310
commit 0b40702b6c
12 changed files with 170 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
use err::Error;
use netpod::{timeunits::*, Channel, ChannelConfig, Cluster, Node, NodeConfig, ScalarType, Shape};
use netpod::{timeunits::*, Channel, ChannelConfig, Cluster, Database, Node, NodeConfig, ScalarType, Shape};
use std::sync::Arc;
#[allow(unused_imports)]
use tracing::{debug, error, info, trace, warn};
@@ -62,7 +62,15 @@ fn simple_fetch() {
tb_file_count: 1,
buffer_size: 1024 * 8,
};
let cluster = Cluster { nodes: vec![node] };
let cluster = Cluster {
nodes: vec![node],
database: Database {
name: "daqbuffer".into(),
host: "localhost".into(),
user: "daqbuffer".into(),
pass: "daqbuffer".into(),
},
};
let cluster = Arc::new(cluster);
let node_config = NodeConfig {
node: cluster.nodes[0].clone(),

View File

@@ -5,13 +5,13 @@ use disk::frame::inmem::InMemoryFrameAsyncReadStream;
use err::Error;
use futures_util::TryStreamExt;
use hyper::Body;
use netpod::{Cluster, Node};
use netpod::{Cluster, Database, Node};
use std::sync::Arc;
#[allow(unused_imports)]
use tracing::{debug, error, info, trace, warn};
fn test_cluster() -> Cluster {
let nodes = (0..13)
let nodes = (0..3)
.into_iter()
.map(|id| {
let node = Node {
@@ -27,7 +27,15 @@ fn test_cluster() -> Cluster {
Arc::new(node)
})
.collect();
Cluster { nodes: nodes }
Cluster {
nodes: nodes,
database: Database {
name: "daqbuffer".into(),
host: "localhost".into(),
user: "daqbuffer".into(),
pass: "daqbuffer".into(),
},
}
}
#[test]
@@ -44,13 +52,15 @@ async fn get_cached_0_inner() -> Result<(), Error> {
let end_date: chrono::DateTime<Utc> = "1970-01-01T00:00:51.000Z".parse()?;
let channel_backend = "back";
let channel_name = "wave1";
let bin_count = 4;
let date_fmt = "%Y-%m-%dT%H:%M:%S.%3fZ";
let uri = format!(
"http://{}:{}/api/1/binned?channel_backend={}&channel_name={}&bin_count=4&beg_date={}&end_date={}",
"http://{}:{}/api/1/binned?channel_backend={}&channel_name={}&bin_count={}&beg_date={}&end_date={}",
node0.host,
node0.port,
channel_backend,
channel_name,
bin_count,
beg_date.format(date_fmt),
end_date.format(date_fmt),
);