You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix bug related to the crate tracing-test for writing assertions for logs #1430
However I limited the buffer because I was planning to use it also in production.
I think I decided to copy because it gives us more control on the logging setup. If I remember well, the crate does its own initialization. And there's not much code.
One thing I could not make it work was using an span to identify logs for the tests we are writing the log assertions. It described on:
We are using natural identifiers in the log lines to identify the logs related to the test we are running. For example the "request id".
@da2ce7 has opened an PR that might solve the problem. I guess we can test it adding a new test like this:
#[tokio::test]
async fn should_blab_bla() {
logging::setup();
let span = tracing::info_span!("unique scope");
let _guard = span.enter();
// test ...
assert!(logs_contains_a_line_with(
&["unique scope", "ERROR", "tower_http", "response failed"]
));
}
It seems blocking functions could be the problem but I don't think so. As I mentioned in this comment I think the problem could be spans are not into the spawned threads when we run the test environments.
Closing this as a documented decision, rather than implementing automatic test-span propagation.
The tracker retains its repository-owned bounded test log capture helper and uses explicit identifiers selected by the test author, such as request IDs or info hashes, to associate expected records with assertions. This approach remains customizable and debuggable without requiring pervasive span propagation across the tracker's nested concurrent tasks.
The decision, alternatives, and reopening criteria are recorded in ADR 20260826124959_use_explicit_identifiers_for_test_log_assertions.md (commit 87827cb1). We can reconsider the approach when a concrete logging-test requirement cannot be met using an explicit identifier.
Correction: the earlier close used the wrong lifecycle and state reason. This issue is reopened and will remain open until the documentation PR containing ADR 20260826124959_use_explicit_identifiers_for_test_log_assertions.md is reviewed and merged. That PR will use Closes #1430, so GitHub records the decision and its rationale through the linked PR.
Activity
josecelano commentedon Aug 26, 2026
Closing this as a documented decision, rather than implementing automatic test-span propagation.
The tracker retains its repository-owned bounded test log capture helper and uses explicit identifiers selected by the test author, such as request IDs or info hashes, to associate expected records with assertions. This approach remains customizable and debuggable without requiring pervasive span propagation across the tracker's nested concurrent tasks.
The decision, alternatives, and reopening criteria are recorded in ADR
20260826124959_use_explicit_identifiers_for_test_log_assertions.md(commit87827cb1). We can reconsider the approach when a concrete logging-test requirement cannot be met using an explicit identifier.josecelano commentedon Aug 26, 2026
Correction: the earlier close used the wrong lifecycle and state reason. This issue is reopened and will remain open until the documentation PR containing ADR
20260826124959_use_explicit_identifiers_for_test_log_assertions.mdis reviewed and merged. That PR will useCloses #1430, so GitHub records the decision and its rationale through the linked PR.docs(issues): record log assertion strategy for torrust#1430
chore(issues): archive closed issue torrust#1430 spec
fix(issues): keep torrust#1430 open until PR merge
Merge #2102: docs(adrs): define test log assertion strategy