Skip to content

Commit

Permalink
Minor: Assert test_enabled_backtrace requirements to run (apache#11525
Browse files Browse the repository at this point in the history
)
  • Loading branch information
comphead authored and wiedld committed Jul 31, 2024
1 parent b4076ee commit 2445159
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion datafusion/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,16 @@ mod test {
assert_eq!(res.strip_backtrace(), "Arrow error: Schema error: bar");
}

// RUST_BACKTRACE=1 cargo test --features backtrace --package datafusion-common --lib -- error::test::test_backtrace
// To pass the test the environment variable RUST_BACKTRACE should be set to 1 to enforce backtrace
#[cfg(feature = "backtrace")]
#[test]
#[allow(clippy::unnecessary_literal_unwrap)]
fn test_enabled_backtrace() {
match std::env::var("RUST_BACKTRACE") {
Ok(val) if val == "1" => {}
_ => panic!("Environment variable RUST_BACKTRACE must be set to 1"),
};

let res: Result<(), DataFusionError> = plan_err!("Err");
let err = res.unwrap_err().to_string();
assert!(err.contains(DataFusionError::BACK_TRACE_SEP));
Expand Down

0 comments on commit 2445159

Please sign in to comment.