mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-27 08:29:59 +00:00
feat: add preserve arg to sqlness runner (#3724)
* feat: add preserve arg to sqlness runner Signed-off-by: Ruihang Xia <waynestxia@gmail.com> * replace tempdir with tempfile Signed-off-by: Ruihang Xia <waynestxia@gmail.com> --------- Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
8
.github/workflows/develop.yml
vendored
8
.github/workflows/develop.yml
vendored
@@ -184,13 +184,13 @@ jobs:
|
||||
- name: Unzip binaries
|
||||
run: tar -xvf ./bins.tar.gz
|
||||
- name: Run sqlness
|
||||
run: RUST_BACKTRACE=1 ./bins/sqlness-runner -c ./tests/cases --bins-dir ./bins
|
||||
run: RUST_BACKTRACE=1 ./bins/sqlness-runner -c ./tests/cases --bins-dir ./bins --preserve-state
|
||||
- name: Upload sqlness logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: sqlness-logs
|
||||
path: /tmp/greptime-*.log
|
||||
path: /tmp/sqlness-*
|
||||
retention-days: 3
|
||||
|
||||
sqlness-kafka-wal:
|
||||
@@ -214,13 +214,13 @@ jobs:
|
||||
working-directory: tests-integration/fixtures/kafka
|
||||
run: docker compose -f docker-compose-standalone.yml up -d --wait
|
||||
- name: Run sqlness
|
||||
run: RUST_BACKTRACE=1 ./bins/sqlness-runner -w kafka -k 127.0.0.1:9092 -c ./tests/cases --bins-dir ./bins
|
||||
run: RUST_BACKTRACE=1 ./bins/sqlness-runner -w kafka -k 127.0.0.1:9092 -c ./tests/cases --bins-dir ./bins --preserve-state
|
||||
- name: Upload sqlness logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: sqlness-logs-with-kafka-wal
|
||||
path: /tmp/greptime-*.log
|
||||
path: /tmp/sqlness-*
|
||||
retention-days: 3
|
||||
|
||||
fmt:
|
||||
|
||||
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -9539,6 +9539,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sqlness",
|
||||
"tempfile",
|
||||
"tinytemplate",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
@@ -18,5 +18,6 @@ common-time.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
sqlness = { version = "0.5" }
|
||||
tempfile.workspace = true
|
||||
tinytemplate = "1.2"
|
||||
tokio.workspace = true
|
||||
|
||||
@@ -67,16 +67,22 @@ struct Args {
|
||||
/// If not set, sqlness will build GreptimeDB on the fly.
|
||||
#[clap(long)]
|
||||
bins_dir: Option<PathBuf>,
|
||||
|
||||
/// Preserve persistent state in the temporary directory.
|
||||
/// This may affect future test runs.
|
||||
#[clap(long)]
|
||||
preserve_state: bool,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
#[cfg(windows)]
|
||||
let data_home = std::env::temp_dir();
|
||||
#[cfg(not(windows))]
|
||||
let data_home = std::path::PathBuf::from("/tmp");
|
||||
let temp_dir = tempfile::Builder::new()
|
||||
.prefix("sqlness")
|
||||
.tempdir()
|
||||
.unwrap();
|
||||
let data_home = temp_dir.path().to_path_buf();
|
||||
|
||||
let config = ConfigBuilder::default()
|
||||
.case_dir(util::get_case_dir(args.case_dir))
|
||||
@@ -104,4 +110,9 @@ async fn main() {
|
||||
Env::new(data_home, args.server_addr, wal, args.bins_dir),
|
||||
);
|
||||
runner.run().await.unwrap();
|
||||
|
||||
// skip clean up and exit
|
||||
if args.preserve_state {
|
||||
println!("Preserving state in {:?}", temp_dir.into_path());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user