logstash/qa/integration/services/dockerized/helpers.sh
Wainer dos Santos Moschetta f9d313c535 ci: dockerized elastisearch service.
This change makes the elasticsearch service used
in integration tests be installed and started in
a docker container.

Fixes #7097

Fixes #7234
2017-06-06 10:29:19 +00:00

23 lines
479 B
Bash

#!/bin/bash
##
# Add routines and/or variables that can be shared between the
# service containers.
##
PORT_WAIT_COUNT=20
# Check service responds on given port.
# Parameters:
# - the port number.
wait_for_port() {
count=$PORT_WAIT_COUNT
port=$1
while ! nc -z localhost $port && [[ $count -ne 0 ]]; do
count=$(( $count - 1 ))
[[ $count -eq 0 ]] && return 1
sleep 0.5
done
# just in case, one more time
nc -z localhost $port
}