Skip to content

Commit

Permalink
fix: resolve PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelScofield committed Jan 29, 2024
1 parent c55da8b commit 65c4e0d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions tests/runner/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ impl EnvController for Env {
}

impl Env {
pub fn new(data_home: PathBuf, server_addr: Option<String>, 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<String>,
wal: WalConfig,
bins_dir: Option<PathBuf>,
) -> Self {
Self {
data_home,
server_addr,
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 9 additions & 1 deletion tests/runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,

/// 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<PathBuf>,
}

#[tokio::main]
Expand Down Expand Up @@ -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();
}

0 comments on commit 65c4e0d

Please sign in to comment.