Skip to content

Commit

Permalink
support specific handler in args and change logic test ci scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
xudong963 committed Dec 14, 2022
1 parent bd66f43 commit 54b683b
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 35 deletions.
22 changes: 6 additions & 16 deletions scripts/ci/ci-run-sqllogic-tests-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@ set -e
echo "Starting Cluster databend-query"
./scripts/ci/deploy/databend-query-cluster-3-nodes.sh

SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
cd "$SCRIPT_PATH/../../tests/logictest" || exit

TEST_HANDLERS=${TEST_HANDLERS:-"mysql,http,clickhouse"}

RUN_DIR=""
if [ $# -gt 0 ]; then
RUN_DIR="--run-dir $*"
fi
echo "Run suites using argument: $RUN_DIR"
echo -e "ulimit:\n$(ulimit -a)"

echo "pip list"
python3 -m pip list
echo "Starting databend-sqllogic tests under mysql"
cargo run -p sqllogictests -- --handler mysql

echo "Starting databend-sqllogic tests"
python3 main.py --handlers ${TEST_HANDLERS} ${RUN_DIR}
echo "Starting databend-sqllogic tests under http"
cargo run -p sqllogictests -- --handler http

echo "Starting databend-sqllogic mode cluster"
python3 main.py --handlers ${TEST_HANDLERS} --suite suites/mode --run-dir cluster
echo "Starting databend-sqllogic tests under clickhouse"
cargo run -p sqllogictests -- --handler clickhouse
22 changes: 6 additions & 16 deletions scripts/ci/ci-run-sqllogic-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,13 @@ set -e
echo "Starting standalone DatabendQuery and DatabendMeta"
./scripts/ci/deploy/databend-query-standalone.sh

SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
cd "$SCRIPT_PATH/../../tests/logictest" || exit

TEST_HANDLERS=${TEST_HANDLERS:-"mysql,http,clickhouse"}

RUN_DIR=""
if [ $# -gt 0 ]; then
RUN_DIR="--run-dir $*"
fi
echo "Run suites using argument: $RUN_DIR"
echo -e "ulimit:\n$(ulimit -a)"

echo "pip list"
python3 -m pip list
echo "Starting databend-sqllogic tests under mysql"
cargo run -p sqllogictests -- --skip_dir cluster --handler mysql

echo "Starting databend-sqllogic tests"
python3 main.py --handlers ${TEST_HANDLERS} --skip-dir=mode ${RUN_DIR}
echo "Starting databend-sqllogic tests under http"
cargo run -p sqllogictests -- --skip_dir cluster --handler http

echo "Starting databend-sqllogic mode standalone"
python3 main.py --handlers ${TEST_HANDLERS} --suite suites/mode --run-dir standalone
echo "Starting databend-sqllogic tests under clickhouse"
cargo run -p sqllogictests -- --skip_dir cluster --handler clickhouse
8 changes: 8 additions & 0 deletions tests/sqllogictests/src/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,12 @@ pub struct SqlLogicTestArgs {
help = "Skip sqllogictests in specific directory, the arg is optional"
)]
pub skipped_dir: Option<String>,

// Set handler to run tests
#[arg(
short = 'c',
long = "handler",
help = "Choose a handler to run tests, support mysql, http, clickhouse handler, the arg is optional."
)]
pub handler: Option<String>,
}
27 changes: 24 additions & 3 deletions tests/sqllogictests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,38 @@ impl sqllogictest::AsyncDB for Databend {
#[tokio::main]
pub async fn main() -> Result<()> {
env_logger::init();
let args = SqlLogicTestArgs::parse();
if let Some(handler) = &args.handler {
match handler.as_str() {
"mysql" => {
println!("Mysql client starts to run...");
run_mysql_client().await?;
}
"http" => {
println!("Http client starts to run...");
run_http_client().await?;
}
"clickhouse" => {
println!("Clickhouse http client starts to run...");
run_ck_http_client().await?;
}
_ => unreachable!(),
}
return Ok(());
}
// If args don't set handler, run all handlers one by one.

// First run databend with mysql client
println!("Mysql client starts to run...");
run_mysql_client().await?;

// Second run databend with http client
// println!("Http client starts to run...");
println!("Http client starts to run...");
// run_http_client().await?;

// println!("Clickhouse http client starts to run...");
// Third run databend with clickhouse http client
// run_ck_http_client().await?;
println!("Clickhouse http client starts to run...");
run_ck_http_client().await?;

Ok(())
}
Expand Down

0 comments on commit 54b683b

Please sign in to comment.