()
| 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() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…