Skip to content

Commit

Permalink
fix(elasticsearch): wait for
Browse files Browse the repository at this point in the history
Wait for the HTTP port to be available to prevent random failures when
the container isn't fully started and returns 503 errors.
  • Loading branch information
stevenh committed Jul 31, 2024
1 parent b9cc19c commit 78e9b76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/elasticsearch/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustom
// matches 8.0 JSON logging with no whitespace between message field and content
// matches 7.x JSON logging with whitespace between message field and content
// matches 6.x text logging with node name in brackets and just a 'started' message till the end of the line
WaitingFor: wait.ForLog(`.*("message":\s?"started(\s|")?.*|]\sstarted\n)`).AsRegexp(),
WaitingFor: wait.ForAll(
wait.ForLog(`.*("message":\s?"started(\s|")?.*|]\sstarted\n)`).AsRegexp(),
wait.ForHTTP("/").WithPort(defaultHTTPPort),
),
LifecycleHooks: []testcontainers.ContainerLifecycleHooks{
{
// the container needs a post create hook to set the default JVM options in a file
Expand Down

0 comments on commit 78e9b76

Please sign in to comment.