Skip to content

Commit ce054c8

Browse files
committed
(test) add test for batch query
1 parent d43101b commit ce054c8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

influxdb/src/query/write_query.rs

+22
Original file line numberDiff line numberDiff line change
@@ -340,4 +340,26 @@ mod tests {
340340
r#"wea\,\ ther=,location=us-midwest,loc\,\ \="ation=us\,\ \"mid\=west temperature=82i,"temp\=era\,t\ ure"="too\"\\\\hot",float=82 11"#
341341
);
342342
}
343+
344+
#[test]
345+
fn test_batch() {
346+
let q0 = Timestamp::Hours(11)
347+
.into_query("wea, ther=")
348+
.add_field("temperature", 82)
349+
.add_field("float", 82.0)
350+
.add_tag("location", "us-midwest");
351+
352+
let q1 = Timestamp::Hours(12)
353+
.into_query("wea, ther=")
354+
.add_field("temperature", 65)
355+
.add_field("float", 65.0)
356+
.add_tag("location", "us-midwest");
357+
358+
let query = vec![q0, q1].build();
359+
360+
assert_eq!(
361+
query.unwrap().get(),
362+
r#"weather,location=us-midwest,season=summer temperature=82i 11\nweather,location=us-midwest,season=summer temperature=65i 11"#
363+
);
364+
}
343365
}

0 commit comments

Comments
 (0)