Merge pull request #1180 from influxdata/ntran/fix_flaky_test
fix: check filename to have deterministic outputpull/24376/head
commit
a728494c76
|
@ -1078,26 +1078,24 @@ mod tests {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("path_list: {:#?}", path_list);
|
println!("path_list: {:#?}", path_list);
|
||||||
assert_eq!(path_list.len(), 2);
|
assert_eq!(path_list.len(), 2);
|
||||||
assert_eq!(path_list, paths.clone());
|
|
||||||
|
|
||||||
// Check the content of each path
|
// Check the content of each path
|
||||||
|
//
|
||||||
// Root path
|
// Root path
|
||||||
let root_path = format!("{:?}", root.path());
|
let root_path = format!("{:?}", root.path());
|
||||||
let root_path = root_path.trim_matches('"');
|
let root_path = root_path.trim_matches('"');
|
||||||
|
|
||||||
let mut i = 0;
|
for path in path_list {
|
||||||
while i < 2 {
|
|
||||||
// Get full string path
|
// Get full string path
|
||||||
let path = format!("{}/{}", root_path, paths[i].display());
|
let path_string = format!("{}/{}", root_path, path.display());
|
||||||
println!("path: {}", path);
|
println!("path: {}", path_string);
|
||||||
|
|
||||||
// Create External table of this parquet file to get its content in a human
|
// Create External table of this parquet file to get its content in a human
|
||||||
// readable form
|
// readable form
|
||||||
// Note: We do not care about escaping quotes here because it is just a test
|
// Note: We do not care about escaping quotes here because it is just a test
|
||||||
let sql = format!(
|
let sql = format!(
|
||||||
"CREATE EXTERNAL TABLE parquet_table STORED AS PARQUET LOCATION '{}'",
|
"CREATE EXTERNAL TABLE parquet_table STORED AS PARQUET LOCATION '{}'",
|
||||||
path
|
path_string
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut ctx = context::ExecutionContext::new();
|
let mut ctx = context::ExecutionContext::new();
|
||||||
|
@ -1108,26 +1106,28 @@ mod tests {
|
||||||
let sql = "SELECT * FROM parquet_table";
|
let sql = "SELECT * FROM parquet_table";
|
||||||
let content = ctx.sql(&sql).unwrap().collect().await.unwrap();
|
let content = ctx.sql(&sql).unwrap().collect().await.unwrap();
|
||||||
println!("Content: {:?}", content);
|
println!("Content: {:?}", content);
|
||||||
let mut expected = vec![
|
let expected = if path_string.contains("cpu") {
|
||||||
|
// file name: cpu.parquet
|
||||||
|
vec![
|
||||||
"+-----+------+",
|
"+-----+------+",
|
||||||
"| bar | time |",
|
"| bar | time |",
|
||||||
"+-----+------+",
|
"+-----+------+",
|
||||||
"| 1 | 10 |",
|
"| 1 | 10 |",
|
||||||
"| 2 | 20 |",
|
"| 2 | 20 |",
|
||||||
"+-----+------+",
|
"+-----+------+",
|
||||||
];
|
]
|
||||||
if i == 1 {
|
} else {
|
||||||
expected = vec![
|
// file name: disk.parquet
|
||||||
|
vec![
|
||||||
"+-----+------+",
|
"+-----+------+",
|
||||||
"| ops | time |",
|
"| ops | time |",
|
||||||
"+-----+------+",
|
"+-----+------+",
|
||||||
"| 1 | 20 |",
|
"| 1 | 20 |",
|
||||||
"+-----+------+",
|
"+-----+------+",
|
||||||
];
|
]
|
||||||
}
|
};
|
||||||
|
|
||||||
assert_table_eq!(expected, &content);
|
assert_table_eq!(expected, &content);
|
||||||
i += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue