Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Add test about batch processor with current_thread async runtime #2123

Merged
merged 8 commits into from
Sep 24, 2024
20 changes: 20 additions & 0 deletions opentelemetry-sdk/src/logs/log_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,26 @@ mod tests {
assert_eq!(1, exporter.get_emitted_logs().unwrap().len())
}


#[tokio::test(flavor = "current_thread")]
async fn test_batch_log_processor_shutdown_with_async_runtime() {
let exporter = InMemoryLogsExporterBuilder::default()
.keep_records_on_shutdown()
.build();
let processor = BatchLogProcessor::new(
Box::new(exporter.clone()),
BatchConfig::default(),
runtime::Tokio,
cijothomas marked this conversation as resolved.
Show resolved Hide resolved
);

//
// deadloack happens in shutdown with tokio current_thread runtime
//
processor.shutdown().unwrap();

assert!(true);
}

#[derive(Debug)]
struct FirstProcessor {
pub(crate) logs: Arc<Mutex<Vec<(LogRecord, InstrumentationLibrary)>>>,
Expand Down
Loading