Skip to content

Commit

Permalink
feat:add check port before start sqlness test (#1895)
Browse files Browse the repository at this point in the history
* feat:add check port before start sqlness test

* cr comment

* feat:remove redundant check_port

* cr comment

* cr comment

* cr comment
  • Loading branch information
Gump9 committed Jul 12, 2023
1 parent 4fdb6d2 commit 2bfe251
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/runner/src/env.rs
Expand Up @@ -183,12 +183,21 @@ impl Env {
_ => panic!("Unexpected subcommand: {subcommand}"),
};

if util::check_port(check_ip_addr.parse().unwrap(), Duration::from_secs(1)).await {
panic!(
"Port {check_ip_addr} is already in use, please check and retry.",
check_ip_addr = check_ip_addr
);
}

let mut process = Command::new("./greptime")
.current_dir(util::get_binary_dir("debug"))
.args(args)
.stdout(log_file)
.spawn()
.unwrap_or_else(|_| panic!("Failed to start the DB with subcommand {subcommand}"));
.unwrap_or_else(|error| {
panic!("Failed to start the DB with subcommand {subcommand},Error: {error}")
});

if !util::check_port(check_ip_addr.parse().unwrap(), Duration::from_secs(10)).await {
Env::stop_server(&mut process);
Expand Down

0 comments on commit 2bfe251

Please sign in to comment.