Improve date formatting
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
use crate::err::ErrConv;
|
||||
use crate::nodes::require_test_hosts_running;
|
||||
use chrono::{DateTime, Utc};
|
||||
use err::Error;
|
||||
use futures_util::Future;
|
||||
use http::{header, Request, StatusCode};
|
||||
use httpclient::{http_get, http_post};
|
||||
use hyper::Body;
|
||||
use netpod::log::*;
|
||||
use netpod::query::api1::{Api1Query, Api1Range};
|
||||
use netpod::query::api1::{Api1Query, Api1Range, ChannelTuple};
|
||||
use url::Url;
|
||||
|
||||
fn testrun<T, F>(fut: F) -> Result<T, Error>
|
||||
@@ -23,11 +24,18 @@ fn events_f64_plain() -> Result<(), Error> {
|
||||
let cluster = &rh.cluster;
|
||||
let node = &cluster.nodes[0];
|
||||
let url: Url = format!("http://{}:{}/api/1/query", node.host, node.port).parse()?;
|
||||
let accept = "application/json";
|
||||
//let qu = Api1Query::new(Api1Range::new(), vec!["testbackend/scalar-i32-be"]);
|
||||
let buf = http_post(url, accept, "{}".into()).await?;
|
||||
let js = String::from_utf8_lossy(&buf);
|
||||
eprintln!("string received: {js}");
|
||||
let accept = "application/octet-stream";
|
||||
let beg: DateTime<Utc> = "1970-01-01T00:00:00Z".parse()?;
|
||||
let end: DateTime<Utc> = "1970-01-01T00:01:00Z".parse()?;
|
||||
let range = Api1Range::new(beg, end)?;
|
||||
// TODO the channel list needs to get pre-processed to check for backend prefix!
|
||||
let ch = ChannelTuple::new("test-disk-databuffer".into(), "scalar-i32-be".into());
|
||||
let qu = Api1Query::new(range, vec![ch]);
|
||||
let body = serde_json::to_string(&qu)?;
|
||||
let buf = http_post(url, accept, body.into()).await?;
|
||||
eprintln!("body received: {}", buf.len());
|
||||
//let js = String::from_utf8_lossy(&buf);
|
||||
//eprintln!("string received: {js}");
|
||||
Ok(())
|
||||
};
|
||||
testrun(fut)?;
|
||||
|
||||
@@ -23,7 +23,7 @@ use url::Url;
|
||||
fn ch_adhoc(name: &str) -> Channel {
|
||||
Channel {
|
||||
series: None,
|
||||
backend: "testbackend".into(),
|
||||
backend: "test-disk-databuffer".into(),
|
||||
name: name.into(),
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ fn ch_adhoc(name: &str) -> Channel {
|
||||
pub fn ch_gen(name: &str) -> Channel {
|
||||
Channel {
|
||||
series: None,
|
||||
backend: "testbackend".into(),
|
||||
backend: "test-disk-databuffer".into(),
|
||||
name: name.into(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ fn events_plain_json_00() -> Result<(), Error> {
|
||||
let cluster = &rh.cluster;
|
||||
events_plain_json(
|
||||
Channel {
|
||||
backend: "testbackend".into(),
|
||||
backend: "test-inmem".into(),
|
||||
name: "inmem-d0-i32".into(),
|
||||
series: None,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user