MCPcopy Create free account
hub / github.com/apache/datafusion / test_runtime_env_builder_reads_env_var

Function test_runtime_env_builder_reads_env_var

benchmarks/src/util/options.rs:181–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

179
180 #[test]
181 fn test_runtime_env_builder_reads_env_var() {
182 // Set the env var and verify runtime_env_builder picks it up
183 // when no CLI --memory-limit is provided
184 let opt = CommonOpt {
185 iterations: 3,
186 partitions: None,
187 batch_size: None,
188 mem_pool_type: "fair".to_string(),
189 memory_limit: None,
190 sort_spill_reservation_bytes: None,
191 debug: false,
192 simulate_latency: false,
193 };
194
195 // With env var set, builder should succeed and have a memory pool
196 // SAFETY: This test is single-threaded and the env var is restored after use
197 unsafe {
198 std::env::set_var("DATAFUSION_RUNTIME_MEMORY_LIMIT", "2G");
199 }
200 let builder = opt.runtime_env_builder().unwrap();
201 let runtime = builder.build().unwrap();
202 unsafe {
203 std::env::remove_var("DATAFUSION_RUNTIME_MEMORY_LIMIT");
204 }
205 // A 2G memory pool should be present — verify it reports the correct limit
206 match runtime.memory_pool.memory_limit() {
207 datafusion::execution::memory_pool::MemoryLimit::Finite(limit) => {
208 assert_eq!(limit, 2 * 1024 * 1024 * 1024);
209 }
210 _ => panic!("Expected Finite memory limit"),
211 }
212 }
213
214 #[test]
215 fn test_parse_capacity_limit_all() {

Callers

nothing calls this directly

Calls 4

runtime_env_builderMethod · 0.80
to_stringMethod · 0.45
buildMethod · 0.45
memory_limitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…