Skip to content

Commit 36c750b

Browse files
committed
Add an extra assertion on the out of order detachment test
1 parent f45e5dd commit 36c750b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

opentelemetry/src/context.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,8 @@ mod tests {
870870
// Create a future that will do some work, referencing our current
871871
// context, but don't await it.
872872
async {
873+
assert_eq!(Context::current().get::<ValueA>(), Some(&ValueA(42)));
874+
873875
let _guard = Context::new().with_value(ValueB(2)).attach();
874876
// Longer work
875877
sleep(Duration::from_millis(50)).await;
@@ -885,7 +887,7 @@ mod tests {
885887

886888
// Execute the future. The completion of the future will result in an out-of-order drop,
887889
// as the parent context created by create_a_future was already dropped earlier.
888-
future.await;
890+
let _a = future.await;
889891

890892
// Nothing terrible (e.g., panics!) should happen, and we should definitely not have any
891893
// values attached to our current context that were set in the nested operations.

0 commit comments

Comments
 (0)