Skip to content

Commit

Permalink
fix ci and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xudong963 committed Dec 16, 2022
1 parent fdba313 commit 4df6699
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 30 deletions.
5 changes: 4 additions & 1 deletion .github/actions/test_sqllogic_cluster_linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tests/logictest/suites/base/03_dml/03_0004_select_order_by
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ statement ok
drop table st1

statement ok
<<<<<<< HEAD
DROP DATABASE db1;

statement ok
Expand Down
5 changes: 0 additions & 5 deletions tests/sqllogictests/src/client/mysql_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,4 @@ impl MysqlClient {
rows: parsed_rows,
})
}

#[allow(dead_code)]
pub fn name(&self) -> &'static str {
"mysql_client"
}
}
25 changes: 3 additions & 22 deletions tests/sqllogictests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<MysqlClient>,
http_client: Option<HttpClient>,
Expand All @@ -79,13 +59,15 @@ impl sqllogictest::AsyncDB for Databend {
type Error = DSqlLogicTestError;

async fn run(&mut self, sql: &str) -> Result<DBOutput> {
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
}

Expand All @@ -96,7 +78,6 @@ impl sqllogictest::AsyncDB for Databend {
if self.ck_client.is_some() {
return "clickhouse";
}

"http"
}
}
Expand Down

0 comments on commit 4df6699

Please sign in to comment.