Skip to content

Commit 58fb8f1

Browse files
committed
chore: fix
1 parent 9fb4076 commit 58fb8f1

File tree

1 file changed

+41
-10
lines changed
  • rust/cubestore/cubestore-sql-tests/src

1 file changed

+41
-10
lines changed

rust/cubestore/cubestore-sql-tests/src/lib.rs

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use async_trait::async_trait;
77
use cubestore::sql::{QueryPlans, SqlQueryContext, SqlService};
88
use cubestore::store::DataFrame;
99
use cubestore::CubeError;
10-
use itertools::Itertools;
11-
use std::env;
10+
use std::env::args;
1211
use std::panic::RefUnwindSafe;
1312
use std::sync::Arc;
1413
use test::TestFn::DynTestFn;
@@ -66,14 +65,19 @@ pub fn run_sql_tests(
6665
})
6766
.collect();
6867

69-
test::test_main(
70-
&env::args()
71-
.chain(extra_args)
72-
.unique()
73-
.collect::<Vec<String>>(),
74-
tests,
75-
None,
76-
);
68+
test::test_main(&merge_args(args().collect(), extra_args), tests, None);
69+
}
70+
71+
fn merge_args(mut base: Vec<String>, extra: Vec<String>) -> Vec<String> {
72+
for extra_arg in extra.into_iter() {
73+
if let Some((arg_name, _arg_value)) = extra_arg.split_once('=') {
74+
base.retain(|a| !a.starts_with(arg_name));
75+
}
76+
77+
base.push(extra_arg.to_string());
78+
}
79+
80+
base
7781
}
7882

7983
#[async_trait]
@@ -94,3 +98,30 @@ impl SqlClient for Arc<dyn SqlService> {
9498
self.as_ref().plan_query(query).await
9599
}
96100
}
101+
102+
#[cfg(test)]
103+
mod test_helpers {
104+
use super::*;
105+
106+
#[test]
107+
fn test_merge_args() {
108+
let base = vec![
109+
"path/to/executable".to_string(),
110+
"--test-threads=1".to_string(),
111+
];
112+
let extra = vec![
113+
"--test-threads=2".to_string(),
114+
"--skip=planning_inplace_aggregate2".to_string(),
115+
];
116+
117+
let merged = merge_args(base, extra);
118+
assert_eq!(
119+
merged,
120+
vec![
121+
"path/to/executable",
122+
"--test-threads=2",
123+
"--skip=planning_inplace_aggregate2"
124+
]
125+
);
126+
}
127+
}

0 commit comments

Comments
 (0)