Commit b2e897d 1 parent 3d56a4f commit b2e897d Copy full SHA for b2e897d
File tree 2 files changed +6
-13
lines changed
opentelemetry-otlp/tests/integration_test
2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 18
18
//!
19
19
#![ cfg( unix) ]
20
20
21
+ use anyhow:: Ok ;
21
22
use anyhow:: Result ;
22
23
use opentelemetry:: { otel_debug, otel_info} ;
23
24
use std:: fs;
@@ -130,19 +131,11 @@ fn upsert_empty_file(path: &str) -> File {
130
131
///
131
132
/// This function is meant to cleanup the generated json file before a test starts,
132
133
/// 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 ( )
135
136
. write ( true )
136
137
. 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
146
139
}
147
140
148
141
///
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ mod logtests {
72
72
#[ cfg( not( feature = "reqwest-client" ) ) ]
73
73
#[ serial_test:: serial]
74
74
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
76
76
77
77
// Make sure the container is running
78
78
use integration_test_runner:: test_utils;
@@ -102,7 +102,7 @@ mod logtests {
102
102
#[ serial_test:: serial]
103
103
#[ cfg( any( feature = "tonic-client" , feature = "reqwest-blocking-client" ) ) ]
104
104
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
106
106
107
107
// Initialize the logger provider inside a tokio runtime
108
108
// as this allows tonic client to capture the runtime,
You can’t perform that action at this time.
0 commit comments