Skip to content

Commit

Permalink
Quit if nginx fails to bind the port
Browse files Browse the repository at this point in the history
Currently, `run_groonga_http` throws an exception and terminates there.
That is why retry by `--n-retries` option is not working.

With this change, the test result is empty and the test fails.
If `--n-retries` is specified, it will be retried.
  • Loading branch information
abetomo committed Feb 18, 2025
1 parent e4350e6 commit d925c49
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/grntest/test-runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -412,17 +412,15 @@ def decide_groonga_server_port(host)

def run_groonga_http(context)
host = "127.0.0.1"
port = decide_groonga_server_port(host)
pid_file_path = context.temporary_directory_path + "groonga.pid"

env = extract_custom_env(context)
spawn_options = {}

command_line = groonga_http_command(host, port, pid_file_path, context,
spawn_options)
pid = nil
n_retries = 0
begin
port = decide_groonga_server_port(host)
command_line = groonga_http_command(host, port, pid_file_path, context,
spawn_options)
pid = Process.spawn(env, *command_line, spawn_options)
executor = nil
begin
Expand All @@ -448,11 +446,9 @@ def run_groonga_http(context)
end
end
end
rescue
sleep(0.1)
n_retries += 1
retry if n_retries < 5
raise
rescue Grntest::Error => error
$stderr.puts("#{error.class}: #{error}")
return
ensure
if pid
begin
Expand Down

0 comments on commit d925c49

Please sign in to comment.