diff --git a/crates/proto/UPSTREAM.md b/crates/proto/UPSTREAM.md index c6dfab0..e7aa7fb 100644 --- a/crates/proto/UPSTREAM.md +++ b/crates/proto/UPSTREAM.md @@ -78,3 +78,7 @@ against or offered back to upstream. "Voelin patch"). TeamSpeak 6 sends some times, e.g. `datetime` of `notifyfilelist`, in milliseconds, which failed to parse and dropped the whole message (empty file lists). Values from 10^11 on (year 5138 in seconds) are taken as milliseconds. +10. **Test logger** (`tsclientlib/src/tests.rs`, "Voelin patch"). The tests' shared + tracing setup used `init`, which panics when quickcheck (`use_logging`) has + already installed a `log` logger; the panic poisoned the `Lazy` and failed every + later test of the binary, depending on test order. It uses `try_init` now. diff --git a/crates/proto/tsclientlib/src/tests.rs b/crates/proto/tsclientlib/src/tests.rs index d5752e8..8e44234 100644 --- a/crates/proto/tsclientlib/src/tests.rs +++ b/crates/proto/tsclientlib/src/tests.rs @@ -2,7 +2,11 @@ use once_cell::sync::Lazy; use ts_bookkeeping::messages::s2c::InMessage; use tsproto_packets::packets::{Direction, Flags, OutPacket, PacketType}; -static TRACING: Lazy<()> = Lazy::new(|| tracing_subscriber::fmt().with_test_writer().init()); +// Voelin patch: `try_init`. quickcheck's logging installs a `log` logger, after +// which `init` panics, poisons this `Lazy` and fails every test that follows. +static TRACING: Lazy<()> = Lazy::new(|| { + let _ = tracing_subscriber::fmt().with_test_writer().try_init(); +}); pub(crate) fn create_logger() { Lazy::force(&TRACING); }