From 65c4e0ddbec33619a37338c1393b178af487465c Mon Sep 17 00:00:00 2001 From: luofucong Date: Mon, 29 Jan 2024 19:40:06 +0800 Subject: [PATCH] fix: resolve PR comments --- .github/workflows/develop.yml | 4 ++-- tests/runner/src/env.rs | 10 +++++++--- tests/runner/src/main.rs | 10 +++++++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 3de7dac37060..d5df2c0da31e 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -127,7 +127,7 @@ jobs: - name: Unzip binaries run: tar -xvf ./bins.tar.gz - name: Run sqlness - run: GREPTIME_BINS_DIR=./bins ./bins/sqlness-runner -c ./tests/cases + run: ./bins/sqlness-runner -c ./tests/cases --bins-dir ./bins - name: Upload sqlness logs if: always() uses: actions/upload-artifact@v3 @@ -158,7 +158,7 @@ jobs: working-directory: tests-integration/fixtures/kafka run: docker compose -f docker-compose-standalone.yml up -d --wait - name: Run sqlness - run: GREPTIME_BINS_DIR=./bins ./bins/sqlness-runner -w kafka -k 127.0.0.1:9092 -c ./tests/cases + run: ./bins/sqlness-runner -w kafka -k 127.0.0.1:9092 -c ./tests/cases --bins-dir ./bins - name: Upload sqlness logs if: always() uses: actions/upload-artifact@v3 diff --git a/tests/runner/src/env.rs b/tests/runner/src/env.rs index 94aedfef2e01..0b9ebe705046 100644 --- a/tests/runner/src/env.rs +++ b/tests/runner/src/env.rs @@ -83,8 +83,12 @@ impl EnvController for Env { } impl Env { - pub fn new(data_home: PathBuf, server_addr: Option, wal: WalConfig) -> Self { - let bins_dir = std::env::var("GREPTIME_BINS_DIR").map(PathBuf::from).ok(); + pub fn new( + data_home: PathBuf, + server_addr: Option, + wal: WalConfig, + bins_dir: Option, + ) -> Self { Self { data_home, server_addr, @@ -257,7 +261,7 @@ impl Env { let program = "greptime.exe"; let bins_dir = self.bins_dir.lock().unwrap().clone().expect( - "GreptimeDB binary is not available. Please set the GREPTIME_BINS_DIR environment variable to the directory that contains the pre-built GreptimeDB binary. Or you may call `self.build_db()` beforehand.", + "GreptimeDB binary is not available. Please pass in the path to the directory that contains the pre-built GreptimeDB binary. Or you may call `self.build_db()` beforehand.", ); let mut process = Command::new(program) diff --git a/tests/runner/src/main.rs b/tests/runner/src/main.rs index c1cd0110562d..415672a759e2 100644 --- a/tests/runner/src/main.rs +++ b/tests/runner/src/main.rs @@ -62,6 +62,11 @@ struct Args { /// from starting a kafka cluster, and use the given endpoint as kafka backend. #[clap(short, long)] kafka_wal_broker_endpoints: Option, + + /// The path to the directory where GreptimeDB's binaries resides. + /// If not set, sqlness will build GreptimeDB on the fly. + #[clap(long)] + bins_dir: Option, } #[tokio::main] @@ -94,6 +99,9 @@ async fn main() { }, }; - let runner = Runner::new(config, Env::new(data_home, args.server_addr, wal)); + let runner = Runner::new( + config, + Env::new(data_home, args.server_addr, wal, args.bins_dir), + ); runner.run().await.unwrap(); }