[TEST] packaging: add debug logging (elastic/x-pack-elasticsearch#3892)

* [TEST] packaging: add debug logging

Some tests have recurring but intermittent failure on opensuse 42 (see
issues mentioned below). Add debug logging for the places where they
occur. Fail fast when checking to see if es-with-xpack has come up.

For elastic/x-pack-elasticsearch#3817, elastic/x-pack-elasticsearch#3827, and elastic/x-pack-elasticsearch#3862

Original commit: elastic/x-pack-elasticsearch@d69e988a44
This commit is contained in:
Andy Bristol 2018-02-13 10:56:17 -08:00 committed by GitHub
parent 2f4dcf36a9
commit 4de793bdb0
3 changed files with 15 additions and 5 deletions

View File

@ -95,6 +95,7 @@ SETUP_OK
[ "$status" -eq 0 ] || {
echo "Expected x-pack setup-passwords tool exit code to be zero but got [$status]"
cat /tmp/setup-passwords-output-with-bootstrap
debug_collect_logs
false
}

View File

@ -261,6 +261,7 @@ MASTER_SETTINGS
[ "$status" -eq 0 ] || {
echo "Failed to connect to master node using HTTPS:"
echo "$output"
debug_collect_logs
false
}
echo "$output" | grep "node-master"
@ -359,6 +360,7 @@ DATA_SETTINGS
-XPOST "https://127.0.0.1:9200/books/book/0?refresh" \
-d '{"title": "Elasticsearch The Definitive Guide"}')
debug_collect_logs
echo "$testIndex" | grep '"result":"created"'
masterSettings=$(sudo curl -u "elastic:changeme" \

View File

@ -96,12 +96,19 @@ assert_number_of_files() {
wait_for_xpack() {
local host=${1:-localhost}
local port=${2:-9200}
local waitFor
local listening=1
for i in {1..60}; do
waitFor=$(echo "GET / HTTP/1.0" > /dev/tcp/$host/$port; echo $?)
[ "$waitFor" -eq "0" ] && break || sleep 1;
if test_port "$host" "$port"; then
listening=0
break
else
sleep 1
fi
done
[ "$waitFor" -eq "0" ]
[ "$listening" -eq 0 ] || {
echo "Looks like elasticsearch with x-pack never started."
debug_collect_logs
false
}
}