From 2c78e581aa39911a8ad73b4298175463967c9b34 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Fri, 15 Sep 2023 13:11:01 +0800 Subject: [PATCH] add failure test & bump version Signed-off-by: Bugen Zhao --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- sqllogictest-bin/Cargo.toml | 4 ++-- sqllogictest-engines/Cargo.toml | 2 +- sqllogictest/src/runner.rs | 2 +- tests/system_command/system_command.rs | 13 +++++++++++++ tests/system_command/system_command_fail.slt | 2 ++ 7 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 tests/system_command/system_command_fail.slt diff --git a/Cargo.lock b/Cargo.lock index 35198ff..0dedb65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1427,7 +1427,7 @@ dependencies = [ [[package]] name = "sqllogictest" -version = "0.15.3" +version = "0.16.0" dependencies = [ "async-trait", "educe", @@ -1449,7 +1449,7 @@ dependencies = [ [[package]] name = "sqllogictest-bin" -version = "0.15.3" +version = "0.16.0" dependencies = [ "anyhow", "async-trait", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "sqllogictest-engines" -version = "0.15.3" +version = "0.16.0" dependencies = [ "async-trait", "bytes", diff --git a/Cargo.toml b/Cargo.toml index 486de8c..02e22d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ members = ["sqllogictest", "sqllogictest-bin", "sqllogictest-engines", "tests"] [workspace.package] -version = "0.15.3" +version = "0.16.0" edition = "2021" homepage = "https://github.com/risinglightdb/sqllogictest-rs" keywords = ["sql", "database", "parser", "cli"] diff --git a/sqllogictest-bin/Cargo.toml b/sqllogictest-bin/Cargo.toml index 401ac6f..fd30801 100644 --- a/sqllogictest-bin/Cargo.toml +++ b/sqllogictest-bin/Cargo.toml @@ -24,8 +24,8 @@ glob = "0.3" itertools = "0.11" quick-junit = { version = "0.3" } rand = "0.8" -sqllogictest = { path = "../sqllogictest", version = "0.15" } -sqllogictest-engines = { path = "../sqllogictest-engines", version = "0.15" } +sqllogictest = { path = "../sqllogictest", version = "0.16" } +sqllogictest-engines = { path = "../sqllogictest-engines", version = "0.16" } tokio = { version = "1", features = [ "rt", "rt-multi-thread", diff --git a/sqllogictest-engines/Cargo.toml b/sqllogictest-engines/Cargo.toml index a1143e9..43acb3e 100644 --- a/sqllogictest-engines/Cargo.toml +++ b/sqllogictest-engines/Cargo.toml @@ -19,7 +19,7 @@ postgres-types = { version = "0.2.5", features = ["derive", "with-chrono-0_4"] } rust_decimal = { version = "1.30.0", features = ["tokio-pg"] } serde = { version = "1", features = ["derive"] } serde_json = "1" -sqllogictest = { path = "../sqllogictest", version = "0.15" } +sqllogictest = { path = "../sqllogictest", version = "0.16" } thiserror = "1" tokio = { version = "1", features = [ "rt", diff --git a/sqllogictest/src/runner.rs b/sqllogictest/src/runner.rs index 2b94c22..6916eaa 100644 --- a/sqllogictest/src/runner.rs +++ b/sqllogictest/src/runner.rs @@ -613,7 +613,7 @@ impl> Runner { let result = D::run_command(cmd).await; #[derive(thiserror::Error, Debug)] - #[error("external command exited unsuccessfully: {0}")] + #[error("process exited unsuccessfully: {0}")] // message from unstable `ExitStatusError` struct SystemError(ExitStatus); let error: Option> = match result { diff --git a/tests/system_command/system_command.rs b/tests/system_command/system_command.rs index 3c433c8..5566afa 100644 --- a/tests/system_command/system_command.rs +++ b/tests/system_command/system_command.rs @@ -47,3 +47,16 @@ fn test() { .run_file("./system_command/system_command.slt") .unwrap(); } + +#[test] +fn test_fail() { + let mut tester = sqllogictest::Runner::new(|| async { Ok(FakeDB) }); + // enable `__TEST_DIR__` override + tester.enable_testdir(); + + let err = tester + .run_file("./system_command/system_command_fail.slt") + .unwrap_err(); + + assert!(err.to_string().contains("system command failed"), "{err}"); +} diff --git a/tests/system_command/system_command_fail.slt b/tests/system_command/system_command_fail.slt new file mode 100644 index 0000000..2831572 --- /dev/null +++ b/tests/system_command/system_command_fail.slt @@ -0,0 +1,2 @@ +system ok +__TEST_DIR__/something_than_not_exist