mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
Enable fallback to sleep if nc not installed
Fixture test scripts use `nc` to wait for the port to determine whether a test fixture is up and running. This commit adds a fall back option to sleep if `nc` is not available - it is not installed on Jenkins centos worker nodes. Fixes #11942
This commit is contained in:
parent
b2da4449a5
commit
e4a5134760
1 changed files with 14 additions and 0 deletions
|
@ -12,6 +12,14 @@ setup_install_dir() {
|
|||
}
|
||||
|
||||
wait_for_port() {
|
||||
if command -v nc 2>/dev/null; then
|
||||
wait_for_port_nc "$@"
|
||||
else
|
||||
wait_for_port_sleep "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_port_nc() {
|
||||
count=$PORT_WAIT_COUNT
|
||||
port=$1
|
||||
while ! nc -z localhost $port && [[ $count -ne 0 ]]; do
|
||||
|
@ -21,6 +29,12 @@ wait_for_port() {
|
|||
done
|
||||
# just in case, one more time
|
||||
nc -z localhost $port
|
||||
|
||||
}
|
||||
|
||||
wait_for_port_sleep() {
|
||||
echo "nc not installed on this machine. Sleeping for 10 seconds"
|
||||
sleep 10
|
||||
}
|
||||
|
||||
clean_install_dir() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue