-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make ignore lists run time and not compile time
- Loading branch information
Showing
10 changed files
with
134 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
query-engine/connector-test-kit-rs/query-test-macros/build.rs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
query-engine/connector-test-kit-rs/query-tests-setup/src/ignore_lists.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use std::{ | ||
fs::File, | ||
io::{BufRead, BufReader}, | ||
path::PathBuf, | ||
sync::OnceLock, | ||
}; | ||
|
||
static IGNORED_TESTS: OnceLock<Vec<String>> = OnceLock::new(); | ||
static SHOULD_FAIL_TESTS: OnceLock<Vec<String>> = OnceLock::new(); | ||
|
||
pub fn is_ignored(test_name: &str) -> bool { | ||
is_in_list(test_name, "IGNORED_TESTS", &IGNORED_TESTS) | ||
} | ||
|
||
pub fn is_expected_to_fail(test_name: &str) -> bool { | ||
is_in_list(test_name, "SHOULD_FAIL_TESTS", &SHOULD_FAIL_TESTS) | ||
} | ||
|
||
fn is_in_list(test_name: &str, env_var: &'static str, cache: &OnceLock<Vec<String>>) -> bool { | ||
let list_file = match std::env::var(env_var) { | ||
Ok(file) => file, | ||
Err(_) => return false, | ||
}; | ||
|
||
let tests = cache.get_or_init(|| { | ||
let workspace_root = std::env::var("WORKSPACE_ROOT").expect("WORKSPACE_ROOT env must be set"); | ||
|
||
let path = PathBuf::from(workspace_root).join(list_file); | ||
let file = File::open(path).expect("could not open file"); | ||
let reader = BufReader::new(file); | ||
|
||
reader | ||
.lines() | ||
.map(|line| line.expect("could not read line")) | ||
.map(|line| { | ||
let trimmed = line.trim(); | ||
if line != trimmed { | ||
trimmed.to_owned() | ||
} else { | ||
line | ||
} | ||
}) | ||
.filter(|line| !line.is_empty() && !line.starts_with('#')) | ||
.collect() | ||
}); | ||
|
||
tests.iter().any(|t| t == test_name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters