@@ -3121,8 +3121,22 @@ mod tests {
3121
3121
3122
3122
const CONFIG_CHANGE_TIMEOUT : std:: time:: Duration = std:: time:: Duration :: from_secs ( 1 ) ;
3123
3123
3124
+ fn clear_environment ( ) {
3125
+ // SAFETY: only used in tests.
3126
+ #[ allow( unsafe_code) ]
3127
+ unsafe {
3128
+ std:: env:: remove_var ( "RERUN_CHUNK_MAX_ROWS_IF_UNSORTED" ) ;
3129
+ std:: env:: remove_var ( "RERUN_FLUSH_NUM_BYTES" ) ;
3130
+ std:: env:: remove_var ( "RERUN_FLUSH_NUM_ROWS" ) ;
3131
+ std:: env:: remove_var ( "RERUN_FLUSH_TICK_SECS" ) ;
3132
+ std:: env:: remove_var ( "RERUN_MAX_CHUNK_ROWS_IF_UNSORTED" ) ;
3133
+ }
3134
+ }
3135
+
3124
3136
#[ test]
3125
3137
fn test_sink_dependent_batcher_config ( ) {
3138
+ clear_environment ( ) ;
3139
+
3126
3140
let ( tx, rx) = std:: sync:: mpsc:: channel ( ) ;
3127
3141
3128
3142
let rec = RecordingStreamBuilder :: new ( "rerun_example_test_batcher_config" )
@@ -3138,14 +3152,18 @@ mod tests {
3138
3152
let new_config = rx
3139
3153
. recv_timeout ( CONFIG_CHANGE_TIMEOUT )
3140
3154
. expect ( "no config change message received within timeout" ) ;
3141
- assert_eq ! ( new_config, ChunkBatcherConfig :: DEFAULT ) ; // buffered sink uses the default config.
3155
+ assert_eq ! (
3156
+ new_config,
3157
+ ChunkBatcherConfig :: from_env( ) . unwrap( ) ,
3158
+ "Buffered sink should uses the config from the environment"
3159
+ ) ;
3142
3160
3143
3161
// Change sink to our custom sink. Will it take over the setting?
3144
3162
let injected_config = ChunkBatcherConfig {
3145
3163
flush_tick : std:: time:: Duration :: from_secs ( 123 ) ,
3146
3164
flush_num_bytes : 123 ,
3147
3165
flush_num_rows : 123 ,
3148
- ..ChunkBatcherConfig :: DEFAULT
3166
+ ..new_config
3149
3167
} ;
3150
3168
rec. set_sink ( Box :: new ( BatcherConfigTestSink {
3151
3169
config : injected_config. clone ( ) ,
@@ -3176,6 +3194,8 @@ mod tests {
3176
3194
3177
3195
#[ test]
3178
3196
fn test_explicit_batcher_config ( ) {
3197
+ clear_environment ( ) ;
3198
+
3179
3199
// This environment variable should *not* override the explicit config.
3180
3200
let _scoped_env_guard = ScopedEnvVarSet :: new ( "RERUN_FLUSH_TICK_SECS" , "456" ) ;
3181
3201
let explicit_config = ChunkBatcherConfig {
0 commit comments