diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a615602..4687b57 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -103,7 +103,7 @@ jobs: - uses: actions/cache@v2 with: path: | - ~/.cargo/bin + ~/.cargo/bin/cargo-tarpaulin ~/.cargo/git ~/.cargo/registry target @@ -111,20 +111,19 @@ jobs: - name: Install Tarpaulin run: | - ls -lh ~/.cargo || true - ls -lh ~/.cargo/bin || true - cargo install cargo-tarpaulin --version ${{ steps.tarpaulin-version.outputs.VERSION }} + ls -lh ~/.cargo/bin + test -e ~/.cargo/bin/cargo-tarpaulin || cargo install cargo-tarpaulin --version ${{ steps.tarpaulin-version.outputs.VERSION }} - name: Run Tarpaulin coverage tests run: | cargo tarpaulin -v \ - --target-dir target/tarpaulin \ - --workspace \ - --all-features \ - --exclude-files 'derive/*' \ - --exclude-files 'target/*' \ - --ignore-panics --ignore-tests \ - --out Html --out Json + --target-dir target/tarpaulin \ + --workspace \ + --all-features \ + --exclude-files 'derive/*' \ + --exclude-files 'target/*' \ + --ignore-panics --ignore-tests \ + --out Html --out Json env: RUST_BACKTRACE: 1 RUST_LOG: info diff --git a/influxdb/tests/derive_integration_tests.rs b/influxdb/tests/derive_integration_tests.rs index 9c136b2..4e507c5 100644 --- a/influxdb/tests/derive_integration_tests.rs +++ b/influxdb/tests/derive_integration_tests.rs @@ -44,6 +44,7 @@ fn test_build_query() { /// /// This integration tests that writing data and retrieving the data again is working #[async_std::test] +#[cfg(not(tarpaulin_include))] async fn test_derive_simple_write() { const TEST_NAME: &str = "test_derive_simple_write"; @@ -73,6 +74,7 @@ async fn test_derive_simple_write() { #[cfg(feature = "derive")] #[cfg(feature = "use-serde")] #[async_std::test] +#[cfg(not(tarpaulin_include))] async fn test_write_and_read_option() { const TEST_NAME: &str = "test_write_and_read_option"; diff --git a/influxdb/tests/integration_tests.rs b/influxdb/tests/integration_tests.rs index 47bb1d1..4dd7020 100644 --- a/influxdb/tests/integration_tests.rs +++ b/influxdb/tests/integration_tests.rs @@ -13,6 +13,7 @@ use influxdb::{Client, Error, Query, Timestamp}; /// /// This test case tests whether the InfluxDB server can be connected to and gathers info about it - tested with async_std #[async_std::test] +#[cfg(not(tarpaulin_include))] async fn test_ping_influx_db_async_std() { let client = create_client("notusedhere"); let result = client.ping().await; @@ -29,6 +30,7 @@ async fn test_ping_influx_db_async_std() { /// /// This test case tests whether the InfluxDB server can be connected to and gathers info about it * tested with tokio #[tokio::test] +#[cfg(not(tarpaulin_include))] async fn test_ping_influx_db_tokio() { let client = create_client("notusedhere"); let result = client.ping().await; @@ -45,6 +47,7 @@ async fn test_ping_influx_db_tokio() { /// /// This test case tests connection error #[async_std::test] +#[cfg(not(tarpaulin_include))] async fn test_connection_error() { let test_name = "test_connection_error"; let client = @@ -65,6 +68,7 @@ async fn test_connection_error() { /// /// This test case tests the Authentication #[async_std::test] +#[cfg(not(tarpaulin_include))] async fn test_authed_write_and_read() { const TEST_NAME: &str = "test_authed_write_and_read"; @@ -112,6 +116,7 @@ async fn test_authed_write_and_read() { /// /// This test case tests the Authentication #[async_std::test] +#[cfg(not(tarpaulin_include))] async fn test_wrong_authed_write_and_read() { const TEST_NAME: &str = "test_wrong_authed_write_and_read"; @@ -181,6 +186,7 @@ async fn test_wrong_authed_write_and_read() { /// /// This test case tests the Authentication #[async_std::test] +#[cfg(not(tarpaulin_include))] async fn test_non_authed_write_and_read() { const TEST_NAME: &str = "test_non_authed_write_and_read"; @@ -235,6 +241,7 @@ async fn test_non_authed_write_and_read() { /// /// This integration tests that writing data and retrieving the data again is working #[async_std::test] +#[cfg(not(tarpaulin_include))] async fn test_write_and_read_field() { const TEST_NAME: &str = "test_write_field"; @@ -268,6 +275,7 @@ async fn test_write_and_read_field() { /// This integration tests that writing data and retrieving the data again is working #[async_std::test] #[cfg(feature = "use-serde")] +#[cfg(not(tarpaulin_include))] async fn test_write_and_read_option() { use serde::Deserialize; @@ -329,6 +337,7 @@ async fn test_write_and_read_option() { /// is equal to the data which was written to the database #[async_std::test] #[cfg(feature = "use-serde")] +#[cfg(not(tarpaulin_include))] async fn test_json_query() { use serde::Deserialize; @@ -380,6 +389,7 @@ async fn test_json_query() { // deserialize_next_tagged into a tags struct #[async_std::test] #[cfg(feature = "use-serde")] +#[cfg(not(tarpaulin_include))] async fn test_json_query_tagged() { use serde::Deserialize; @@ -444,6 +454,7 @@ async fn test_json_query_tagged() { /// (tested with tokio) #[tokio::test] #[cfg(feature = "use-serde")] +#[cfg(not(tarpaulin_include))] async fn test_json_query_vec() { use serde::Deserialize; @@ -494,6 +505,7 @@ async fn test_json_query_vec() { /// This integration test tests whether using the wrong query method fails building the query #[async_std::test] #[cfg(feature = "use-serde")] +#[cfg(not(tarpaulin_include))] async fn test_serde_multi_query() { use serde::Deserialize; @@ -570,6 +582,7 @@ async fn test_serde_multi_query() { /// This integration test tests whether using the wrong query method fails building the query #[async_std::test] #[cfg(feature = "use-serde")] +#[cfg(not(tarpaulin_include))] async fn test_wrong_query_errors() { let client = create_client("test_name"); let result = client diff --git a/influxdb/tests/utilities.rs b/influxdb/tests/utilities.rs index 11a498a..92d4e0e 100644 --- a/influxdb/tests/utilities.rs +++ b/influxdb/tests/utilities.rs @@ -3,14 +3,17 @@ use influxdb::{Client, Error, Query}; use std::panic::{AssertUnwindSafe, UnwindSafe}; #[allow(dead_code)] +#[cfg(not(tarpaulin_include))] pub fn assert_result_err(result: &Result) { result.as_ref().expect_err("assert_result_err failed"); } +#[cfg(not(tarpaulin_include))] pub fn assert_result_ok(result: &Result) { result.as_ref().expect("assert_result_ok failed"); } +#[cfg(not(tarpaulin_include))] pub fn create_client(db_name: T) -> Client where T: Into, @@ -18,6 +21,7 @@ where Client::new("http://localhost:8086", db_name) } +#[cfg(not(tarpaulin_include))] pub async fn create_db(name: T) -> Result where T: Into, @@ -29,6 +33,7 @@ where .await } +#[cfg(not(tarpaulin_include))] pub async fn delete_db(name: T) -> Result where T: Into, @@ -40,6 +45,7 @@ where .await } +#[cfg(not(tarpaulin_include))] pub async fn run_test(test_fn: F, teardown: T) where F: FnOnce() -> Fut1 + UnwindSafe,