@@ -79,7 +79,7 @@ fn traces_simple() {
7979 // Force the server span to be sent before the client span. Without this on Jan's PC
8080 // the server span gets sent after the client span, but on GitHub Actions it's the
8181 // other way around.
82- std:: thread:: sleep ( Duration :: from_millis ( 1000 ) ) ;
82+ std:: thread:: sleep ( Duration :: from_secs ( 1 ) ) ;
8383 } ) ;
8484 } ) ;
8585 let traces_simple = requests_to_string ( requests) ;
@@ -100,12 +100,12 @@ async fn traces_batch_async_std() {
100100 insta:: assert_snapshot!( traces_batch_async_std) ;
101101}
102102
103- #[ tokio:: test( flavor = "multi_thread" ) ]
103+ #[ tokio:: test]
104104async fn traces_batch_tokio ( ) {
105105 let requests = record ( TokioTick , |client| {
106106 let tracer_provider = new_pipeline ( INSTRUMENTATION_KEY . into ( ) )
107107 . with_client ( client)
108- . build_batch ( opentelemetry:: runtime:: Tokio ) ;
108+ . build_batch ( opentelemetry:: runtime:: TokioCurrentThread ) ;
109109 let tracer = tracer_provider. tracer ( "test" ) ;
110110
111111 tracer. in_span ( "tokio" , |_cx| { } ) ;
@@ -120,7 +120,10 @@ mod recording_client {
120120 use bytes:: Bytes ;
121121 use http:: { Request , Response } ;
122122 use opentelemetry_http:: { HttpClient , HttpError } ;
123- use std:: sync:: { Arc , Mutex } ;
123+ use std:: {
124+ sync:: { Arc , Mutex } ,
125+ time:: Duration ,
126+ } ;
124127
125128 #[ derive( Debug , Clone ) ]
126129 pub struct RecordingClient {
@@ -152,6 +155,11 @@ mod recording_client {
152155 requests : Arc :: clone ( & requests) ,
153156 tick : Arc :: new ( tick) ,
154157 } ) ;
158+
159+ // Give async runtime some time to quit. I don't see any way to properly wait for tasks
160+ // spawned with async-std.
161+ std:: thread:: sleep ( Duration :: from_secs ( 1 ) ) ;
162+
155163 Arc :: try_unwrap ( requests)
156164 . expect ( "client is dropped everywhere" )
157165 . into_inner ( )
0 commit comments