Skip to content

Commit 95bc644

Browse files
committed
tests/fuzz: make compound key fuzz test a bit stricter with ordering
1 parent 1189b7a commit 95bc644

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

tests/integration/fuzz/mod.rs

+21-7
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,27 @@ mod tests {
387387
// so we need to check that limbo and sqlite return the same results when the ordering is reversed.
388388
// because we are generally using LIMIT (to make the test complete faster), we need to rerun the query
389389
// without limit and then check that the results are the same if reversed.
390-
let query_no_limit =
391-
format!("SELECT * FROM t {} {} {}", where_clause, order_by, "");
392-
let limbo_no_limit = limbo_exec_rows(&dbs[i], &limbo_conns[i], &query_no_limit);
393-
let sqlite_no_limit = sqlite_exec_rows(&sqlite_conn, &query_no_limit);
394-
let limbo_rev = limbo_no_limit.iter().cloned().rev().collect::<Vec<_>>();
395-
if limbo_rev == sqlite_no_limit {
396-
continue;
390+
let order_by_only_equalities = !order_by_components.is_empty()
391+
&& order_by_components.iter().all(|o: &String| {
392+
if o.starts_with("x ") {
393+
comp1.map_or(false, |c| c == "=")
394+
} else if o.starts_with("y ") {
395+
comp2.map_or(false, |c| c == "=")
396+
} else {
397+
comp3.map_or(false, |c| c == "=")
398+
}
399+
});
400+
401+
if order_by_only_equalities {
402+
let query_no_limit =
403+
format!("SELECT * FROM t {} {} {}", where_clause, order_by, "");
404+
let limbo_no_limit =
405+
limbo_exec_rows(&dbs[i], &limbo_conns[i], &query_no_limit);
406+
let sqlite_no_limit = sqlite_exec_rows(&sqlite_conn, &query_no_limit);
407+
let limbo_rev = limbo_no_limit.iter().cloned().rev().collect::<Vec<_>>();
408+
if limbo_rev == sqlite_no_limit {
409+
continue;
410+
}
397411
}
398412
panic!(
399413
"limbo: {:?}, sqlite: {:?}, seed: {}, query: {}",

0 commit comments

Comments
 (0)