Skip to content

Commit

Permalink
Minor: Assert test_enabled_backtrace requirements to run (#11525)
Browse files Browse the repository at this point in the history
  • Loading branch information
comphead authored Jul 17, 2024
1 parent 58da969 commit 1b9b35c
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 1b9b35c

Please sign in to comment.