From 4df66999671783dbf2880618bc91c76bb3807532 Mon Sep 17 00:00:00 2001 From: xudong963 Date: Fri, 16 Dec 2022 19:19:14 +0800 Subject: [PATCH] fix ci and tests --- .../test_sqllogic_cluster_linux/action.yml | 5 +++- .../base/03_dml/03_0004_select_order_by | 5 +++- .../base/03_dml/03_0016_insert_into_values | 1 - .../sqllogictests/src/client/mysql_client.rs | 5 ---- tests/sqllogictests/src/main.rs | 25 +++---------------- 5 files changed, 11 insertions(+), 30 deletions(-) diff --git a/.github/actions/test_sqllogic_cluster_linux/action.yml b/.github/actions/test_sqllogic_cluster_linux/action.yml index 820aee62546e..00f7433079f8 100644 --- a/.github/actions/test_sqllogic_cluster_linux/action.yml +++ b/.github/actions/test_sqllogic_cluster_linux/action.yml @@ -35,7 +35,10 @@ runs: run: ./scripts/ci/deploy/databend-query-cluster-3-nodes.sh - name: Run sqllogic tests with cluster mode shell: bash - run: cargo run -p sqllogictests + run: | + cargo run -p sqllogictests -- --run_dir base + cargo run -p sqllogictests -- --run_dir query + cargo run -p sqllogictests -- --run_dir cluster env: RUST_TEST_THREADS: "2" RUST_LOG: DEBUG diff --git a/tests/logictest/suites/base/03_dml/03_0004_select_order_by b/tests/logictest/suites/base/03_dml/03_0004_select_order_by index c3a6dc76cc94..2380f12d678e 100644 --- a/tests/logictest/suites/base/03_dml/03_0004_select_order_by +++ b/tests/logictest/suites/base/03_dml/03_0004_select_order_by @@ -101,11 +101,14 @@ SELECT id, var FROM t2 ORDER BY var DESC statement ok DROP TABLE t2 +statement ok +drop table if exists t3 + statement ok CREATE TABLE IF NOT EXISTS t3(id Int null, arr Array(Int32) null) Engine = Fuse statement ok -INSERT INTO t3 VALUES(1, [1,2,3]), (2, [1,2,4]), (3, []), (4, [3,4,5]), (5, [4]), (6, [4,5]) +INSERT INTO t3 VALUES(1, [1,2,3]), (2, [1,2,4]), (3, []), (4, [3,4,5]), (5, [4]), (6, [4,5]) statement ok DROP TABLE t3 diff --git a/tests/logictest/suites/base/03_dml/03_0016_insert_into_values b/tests/logictest/suites/base/03_dml/03_0016_insert_into_values index 23dc19803b29..4408477580cb 100644 --- a/tests/logictest/suites/base/03_dml/03_0016_insert_into_values +++ b/tests/logictest/suites/base/03_dml/03_0016_insert_into_values @@ -59,7 +59,6 @@ statement ok drop table st1 statement ok -<<<<<<< HEAD DROP DATABASE db1; statement ok diff --git a/tests/sqllogictests/src/client/mysql_client.rs b/tests/sqllogictests/src/client/mysql_client.rs index ac8b345c9040..78f60b4d2238 100644 --- a/tests/sqllogictests/src/client/mysql_client.rs +++ b/tests/sqllogictests/src/client/mysql_client.rs @@ -58,9 +58,4 @@ impl MysqlClient { rows: parsed_rows, }) } - - #[allow(dead_code)] - pub fn name(&self) -> &'static str { - "mysql_client" - } } diff --git a/tests/sqllogictests/src/main.rs b/tests/sqllogictests/src/main.rs index 0317a44d7d2c..6d64ce179e4e 100644 --- a/tests/sqllogictests/src/main.rs +++ b/tests/sqllogictests/src/main.rs @@ -12,14 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::HashMap; use std::fs::ReadDir; use std::path::PathBuf; use clap::Parser; use client::ClickhouseHttpClient; -use lazy_static::lazy_static; -use regex::Regex; use sqllogictest::DBOutput; use walkdir::DirEntry; use walkdir::WalkDir; @@ -37,23 +34,6 @@ mod util; const TEST_SUITS: &str = "tests/logictest/suites"; -// Maybe moved later... -lazy_static! { - static ref REGEX_MAP: HashMap<&'static str, Regex> = { - let mut regex_map = HashMap::new(); - regex_map.insert("$ANYTHING", Regex::new(r".*").unwrap()); - regex_map.insert( - "$DATE", - Regex::new(r"\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d[.]\d\d\d [+-]\d\d\d\d").unwrap(), - ); - regex_map.insert( - "$DATE_IN_SHARE", - Regex::new(r"\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d[.]\d+ UTC").unwrap(), - ); - regex_map - }; -} - pub struct Databend { mysql_client: Option, http_client: Option, @@ -79,13 +59,15 @@ impl sqllogictest::AsyncDB for Databend { type Error = DSqlLogicTestError; async fn run(&mut self, sql: &str) -> Result { - println!("Running sql: [{}]", sql); if let Some(mysql_client) = &mut self.mysql_client { + println!("Running sql with mysql client: [{}]", sql); return mysql_client.query(sql); } if let Some(http_client) = &mut self.http_client { + println!("Running sql with http client: [{}]", sql); return http_client.query(sql).await; } + println!("Running sql with clickhouse client: [{}]", sql); self.ck_client.as_mut().unwrap().query(sql).await } @@ -96,7 +78,6 @@ impl sqllogictest::AsyncDB for Databend { if self.ck_client.is_some() { return "clickhouse"; } - "http" } }