Skip to content

Commit

Permalink
chore(smoke-tests): Log tracing span events in smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBardon committed Jan 22, 2025
1 parent b34a1d6 commit 0907380
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 42 deletions.
75 changes: 40 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ axum-extra = { version = "0.10", default-features = false }
axum-test = { version = "17", default-features = false }
base64 = { version = "0.22", default-features = false }
chrono = { version = "0.4", default-features = false }
cucumber = { version = "0.21", default-features = false }
cucumber = { branch = "353-fmt-layer-tweaking", git = "https://github.com/cucumber-rs/cucumber", default-features = false }
email_address = { version = "0.2", default-features = false }
figment = { version = "0.10", default-features = false }
form_urlencoded = { version = "1", default-features = false }
Expand Down
20 changes: 14 additions & 6 deletions crates/rest-api/tests/behavior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ mod prelude;
use cucumber::World as _;
use tracing_subscriber::{
filter::{self, LevelFilter},
fmt::format::{self, Format},
fmt::{
self,
format::{DefaultFields, FmtSpan, Format},
},
layer::{Layer, SubscriberExt as _},
};

Expand All @@ -21,17 +24,22 @@ async fn main() {
TestWorld::cucumber()
// .init_tracing()
.configure_and_init_tracing(
format::DefaultFields::new(),
Format::default()
.without_time()
.with_ansi(true)
.with_source_location(false),
fmt::layer()
.fmt_fields(DefaultFields::new())
.event_format(
Format::default()
.without_time()
.with_ansi(true)
.with_source_location(false),
)
.with_span_events(FmtSpan::NEW | FmtSpan::CLOSE),
|fmt_layer| {
let targets = vec![
("sea_orm_migration", LevelFilter::WARN),
("sea_orm", LevelFilter::INFO),
("sqlx::query", LevelFilter::ERROR),
("globset", LevelFilter::WARN),
("cucumber::tracing", LevelFilter::OFF),
];

let args = std::env::args().collect::<Vec<_>>();
Expand Down

0 comments on commit 0907380

Please sign in to comment.