From 59c575198e75c02fb18f342a02a498502aeb86f5 Mon Sep 17 00:00:00 2001 From: Aleh Zasypkin Date: Sat, 25 Jan 2025 05:00:18 +0200 Subject: [PATCH] fix(tests): enable tracing for the tests that hangs on CI only --- .github/workflows/ci.yml | 3 ++- Cargo.lock | 22 +++++++++++++++++++ Cargo.toml | 1 + .../scheduler_jobs/trackers_run_job.rs | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8ffe1e..86f0815 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,7 @@ jobs: image: postgres:latest env: POSTGRES_HOST_AUTH_METHOD: trust + RUST_LOG: debug ports: - 5432:5432 steps: @@ -60,7 +61,7 @@ jobs: - name: Test (default features) timeout-minutes: 6 - run: cargo test + run: cargo test -- --nocapture - name: Build (default features) run: cargo build --release diff --git a/Cargo.lock b/Cargo.lock index 4ff7883..62e212f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4051,6 +4051,7 @@ dependencies = [ "tracing", "tracing-actix-web", "tracing-subscriber", + "tracing-test", "trust-dns-resolver", "url", "urlencoding", @@ -5461,6 +5462,27 @@ dependencies = [ "tracing-serde", ] +[[package]] +name = "tracing-test" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "557b891436fe0d5e0e363427fc7f217abf9ccd510d5136549847bdcbcd011d68" +dependencies = [ + "tracing-core", + "tracing-subscriber", + "tracing-test-macro", +] + +[[package]] +name = "tracing-test-macro" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" +dependencies = [ + "quote", + "syn 2.0.96", +] + [[package]] name = "trust-dns-proto" version = "0.23.2" diff --git a/Cargo.toml b/Cargo.toml index 32e9219..b9eae75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,6 +71,7 @@ uuid = "1.12.1" httpmock = "0.7.0" insta = "1.42.0" toml = "0.8.19" +tracing-test = "0.2.5" [features] default = [ diff --git a/src/scheduler/scheduler_jobs/trackers_run_job.rs b/src/scheduler/scheduler_jobs/trackers_run_job.rs index 419380e..e03146e 100644 --- a/src/scheduler/scheduler_jobs/trackers_run_job.rs +++ b/src/scheduler/scheduler_jobs/trackers_run_job.rs @@ -430,6 +430,7 @@ mod tests { use sqlx::PgPool; use std::{ops::Add, sync::Arc, time::Duration}; use time::OffsetDateTime; + use tracing_test::traced_test; use uuid::uuid; #[sqlx::test] @@ -1468,6 +1469,7 @@ mod tests { } #[sqlx::test] + #[traced_test] async fn can_schedule_retries_if_request_fails(pool: PgPool) -> anyhow::Result<()> { let mut config = mock_config()?; config.smtp = config.smtp.map(|config| SmtpConfig {