Skip to content

Commit d465bb4

Browse files
committed
[TEST] Add test about batch processor with current_thread async runtime
1 parent 7a074b5 commit d465bb4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

opentelemetry-sdk/src/logs/log_processor.rs

+20
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,26 @@ mod tests {
812812
assert_eq!(1, exporter.get_emitted_logs().unwrap().len())
813813
}
814814

815+
816+
#[tokio::test(flavor = "current_thread")]
817+
async fn test_batch_log_processor_shutdown_with_async_runtime() {
818+
let exporter = InMemoryLogsExporterBuilder::default()
819+
.keep_records_on_shutdown()
820+
.build();
821+
let processor = BatchLogProcessor::new(
822+
Box::new(exporter.clone()),
823+
BatchConfig::default(),
824+
runtime::Tokio,
825+
);
826+
827+
//
828+
// deadloack happens in shutdown with tokio current_thread runtime
829+
//
830+
processor.shutdown().unwrap();
831+
832+
assert!(true);
833+
}
834+
815835
#[derive(Debug)]
816836
struct FirstProcessor {
817837
pub(crate) logs: Arc<Mutex<Vec<(LogRecord, InstrumentationLibrary)>>>,

0 commit comments

Comments
 (0)