Skip to content

Commit dd8b574

Browse files
committed
test with tokio by default
1 parent cebc42e commit dd8b574

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

influxdb/tests/derive_integration_tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ fn test_build_query() {
5151
/// INTEGRATION TEST
5252
///
5353
/// This integration tests that writing data and retrieving the data again is working
54-
#[async_std::test]
54+
#[cfg_attr(feature = "surf", tokio02::test)]
55+
#[cfg_attr(feature = "reqwest", tokio::test)]
5556
#[cfg(not(tarpaulin_include))]
5657
async fn test_derive_simple_write() {
5758
const TEST_NAME: &str = "test_derive_simple_write";
@@ -82,7 +83,8 @@ async fn test_derive_simple_write() {
8283
/// This integration tests that writing data and retrieving the data again is working
8384
#[cfg(feature = "derive")]
8485
#[cfg(feature = "use-serde")]
85-
#[async_std::test]
86+
#[cfg_attr(feature = "surf", tokio02::test)]
87+
#[cfg_attr(feature = "reqwest", tokio::test)]
8688
#[cfg(not(tarpaulin_include))]
8789
async fn test_write_and_read_option() {
8890
const TEST_NAME: &str = "test_write_and_read_option";

influxdb/tests/integration_tests.rs

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use influxdb::{Client, Error, Query, Timestamp};
1313
///
1414
/// This test case tests whether the InfluxDB server can be connected to and gathers info about it - tested with async_std
1515
#[async_std::test]
16-
#[cfg(not(tarpaulin_include))]
16+
#[cfg(not(any(tarpaulin_include, feature = "reqwest")))]
1717
async fn test_ping_influx_db_async_std() {
1818
let client = create_client("notusedhere");
1919
let result = client.ping().await;
@@ -29,7 +29,8 @@ async fn test_ping_influx_db_async_std() {
2929
/// INTEGRATION TEST
3030
///
3131
/// This test case tests whether the InfluxDB server can be connected to and gathers info about it * tested with tokio
32-
#[tokio::test]
32+
#[cfg_attr(feature = "surf", tokio02::test)]
33+
#[cfg_attr(feature = "reqwest", tokio::test)]
3334
#[cfg(not(tarpaulin_include))]
3435
async fn test_ping_influx_db_tokio() {
3536
let client = create_client("notusedhere");
@@ -46,7 +47,8 @@ async fn test_ping_influx_db_tokio() {
4647
/// INTEGRATION TEST
4748
///
4849
/// This test case tests connection error
49-
#[async_std::test]
50+
#[cfg_attr(feature = "surf", tokio02::test)]
51+
#[cfg_attr(feature = "reqwest", tokio::test)]
5052
#[cfg(not(tarpaulin_include))]
5153
async fn test_connection_error() {
5254
let test_name = "test_connection_error";
@@ -67,7 +69,8 @@ async fn test_connection_error() {
6769
/// INTEGRATION TEST
6870
///
6971
/// This test case tests the Authentication
70-
#[async_std::test]
72+
#[cfg_attr(feature = "surf", tokio02::test)]
73+
#[cfg_attr(feature = "reqwest", tokio::test)]
7174
#[cfg(not(tarpaulin_include))]
7275
async fn test_authed_write_and_read() {
7376
const TEST_NAME: &str = "test_authed_write_and_read";
@@ -115,7 +118,8 @@ async fn test_authed_write_and_read() {
115118
/// INTEGRATION TEST
116119
///
117120
/// This test case tests the Authentication
118-
#[async_std::test]
121+
#[cfg_attr(feature = "surf", tokio02::test)]
122+
#[cfg_attr(feature = "reqwest", tokio::test)]
119123
#[cfg(not(tarpaulin_include))]
120124
async fn test_wrong_authed_write_and_read() {
121125
const TEST_NAME: &str = "test_wrong_authed_write_and_read";
@@ -185,7 +189,8 @@ async fn test_wrong_authed_write_and_read() {
185189
/// INTEGRATION TEST
186190
///
187191
/// This test case tests the Authentication
188-
#[async_std::test]
192+
#[cfg_attr(feature = "surf", tokio02::test)]
193+
#[cfg_attr(feature = "reqwest", tokio::test)]
189194
#[cfg(not(tarpaulin_include))]
190195
async fn test_non_authed_write_and_read() {
191196
const TEST_NAME: &str = "test_non_authed_write_and_read";
@@ -240,7 +245,8 @@ async fn test_non_authed_write_and_read() {
240245
/// INTEGRATION TEST
241246
///
242247
/// This integration tests that writing data and retrieving the data again is working
243-
#[async_std::test]
248+
#[cfg_attr(feature = "surf", tokio02::test)]
249+
#[cfg_attr(feature = "reqwest", tokio::test)]
244250
#[cfg(not(tarpaulin_include))]
245251
async fn test_write_and_read_field() {
246252
const TEST_NAME: &str = "test_write_field";
@@ -273,7 +279,8 @@ async fn test_write_and_read_field() {
273279
/// INTEGRATION TEST
274280
///
275281
/// This integration tests that writing data and retrieving the data again is working
276-
#[async_std::test]
282+
#[cfg_attr(feature = "surf", tokio02::test)]
283+
#[cfg_attr(feature = "reqwest", tokio::test)]
277284
#[cfg(feature = "use-serde")]
278285
#[cfg(not(tarpaulin_include))]
279286
async fn test_write_and_read_option() {
@@ -335,7 +342,8 @@ async fn test_write_and_read_option() {
335342
///
336343
/// This test case tests whether JSON can be decoded from a InfluxDB response and whether that JSON
337344
/// is equal to the data which was written to the database
338-
#[async_std::test]
345+
#[cfg_attr(feature = "surf", tokio02::test)]
346+
#[cfg_attr(feature = "reqwest", tokio::test)]
339347
#[cfg(feature = "use-serde")]
340348
#[cfg(not(tarpaulin_include))]
341349
async fn test_json_query() {
@@ -386,8 +394,9 @@ async fn test_json_query() {
386394
/// INTEGRATION TEST
387395
///
388396
/// This test case tests whether the response to a GROUP BY can be parsed by
389-
// deserialize_next_tagged into a tags struct
390-
#[async_std::test]
397+
/// deserialize_next_tagged into a tags struct
398+
#[cfg_attr(feature = "surf", tokio02::test)]
399+
#[cfg_attr(feature = "reqwest", tokio::test)]
391400
#[cfg(feature = "use-serde")]
392401
#[cfg(not(tarpaulin_include))]
393402
async fn test_json_query_tagged() {
@@ -451,8 +460,8 @@ async fn test_json_query_tagged() {
451460
///
452461
/// This test case tests whether JSON can be decoded from a InfluxDB response and wether that JSON
453462
/// is equal to the data which was written to the database
454-
/// (tested with tokio)
455-
#[tokio::test]
463+
#[cfg_attr(feature = "surf", tokio02::test)]
464+
#[cfg_attr(feature = "reqwest", tokio::test)]
456465
#[cfg(feature = "use-serde")]
457466
#[cfg(not(tarpaulin_include))]
458467
async fn test_json_query_vec() {
@@ -503,7 +512,8 @@ async fn test_json_query_vec() {
503512
/// INTEGRATION TEST
504513
///
505514
/// This integration test tests whether using the wrong query method fails building the query
506-
#[async_std::test]
515+
#[cfg_attr(feature = "surf", tokio02::test)]
516+
#[cfg_attr(feature = "reqwest", tokio::test)]
507517
#[cfg(feature = "use-serde")]
508518
#[cfg(not(tarpaulin_include))]
509519
async fn test_serde_multi_query() {
@@ -580,7 +590,8 @@ async fn test_serde_multi_query() {
580590
/// INTEGRATION TEST
581591
///
582592
/// This integration test tests whether using the wrong query method fails building the query
583-
#[async_std::test]
593+
#[cfg_attr(feature = "surf", tokio02::test)]
594+
#[cfg_attr(feature = "reqwest", tokio::test)]
584595
#[cfg(feature = "use-serde")]
585596
#[cfg(not(tarpaulin_include))]
586597
async fn test_wrong_query_errors() {

0 commit comments

Comments
 (0)