File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
opentelemetry-otlp/tests/integration_test Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 1818//!
1919#![ cfg( unix) ]
2020
21+ use anyhow:: Ok ;
2122use anyhow:: Result ;
2223use opentelemetry:: { otel_debug, otel_info} ;
2324use std:: fs;
@@ -130,19 +131,11 @@ fn upsert_empty_file(path: &str) -> File {
130131///
131132/// This function is meant to cleanup the generated json file before a test starts,
132133/// preventing entries from previous tests from interfering with the current test's results.
133- pub fn cleanup_logs_file ( file_path : & str ) -> Result < ( ) > {
134- let file = OpenOptions :: new ( )
134+ pub fn cleanup_logs_file ( file_path : & str ) {
135+ let _ = OpenOptions :: new ( )
135136 . write ( true )
136137 . truncate ( true )
137- . open ( file_path) ;
138- match file {
139- Ok ( _) => Ok ( ( ) ) ,
140- Err ( err) => Err ( anyhow:: anyhow!(
141- "Failed to clean up file '{}': {:?}" ,
142- file_path,
143- err
144- ) ) ,
145- }
138+ . open ( file_path) ; // ignore result, as file may not exist
146139}
147140
148141///
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ mod logtests {
7272 #[ cfg( not( feature = "reqwest-client" ) ) ]
7373 #[ serial_test:: serial]
7474 pub async fn test_logs ( ) -> Result < ( ) > {
75- test_utils:: cleanup_logs_file ( "./actual/logs.json" ) ? ; // Ensure logs.json is empty before the test
75+ test_utils:: cleanup_logs_file ( "./actual/logs.json" ) ; // Ensure logs.json is empty before the test
7676
7777 // Make sure the container is running
7878 use integration_test_runner:: test_utils;
@@ -102,7 +102,7 @@ mod logtests {
102102 #[ serial_test:: serial]
103103 #[ cfg( any( feature = "tonic-client" , feature = "reqwest-blocking-client" ) ) ]
104104 pub fn logs_batch_non_tokio_main ( ) -> Result < ( ) > {
105- test_utils:: cleanup_logs_file ( "./actual/logs.json" ) ? ; // Ensure logs.json is empty before the test
105+ test_utils:: cleanup_logs_file ( "./actual/logs.json" ) ; // Ensure logs.json is empty before the test
106106
107107 // Initialize the logger provider inside a tokio runtime
108108 // as this allows tonic client to capture the runtime,
You can’t perform that action at this time.
0 commit comments