[package testing] Show kibana logs on exit (#128619) (#130328)

* [package testing] Show kibana logs on exit

* fix syntax

* fix syntax

* fix

* use absolute path

* wrap in fn

(cherry picked from commit 0300e02718)

Co-authored-by: Jonathan Budzenski <jon@elastic.co>
Co-authored-by: Spencer <spencer@elastic.co>
This commit is contained in:
Kibana Machine 2022-04-18 17:46:29 -05:00 committed by GitHub
parent 1f2ccb1f2e
commit 3f86f900e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@ elif [[ "$TEST_PACKAGE" == "docker" ]]; then
fi
cd ..
export VAGRANT_CWD=test/package
export VAGRANT_CWD=$PWD/test/package
vagrant up "$TEST_PACKAGE" --no-provision
node scripts/es snapshot \
@ -29,6 +29,16 @@ node scripts/es snapshot \
--license=trial &
while ! timeout 1 bash -c "echo > /dev/tcp/localhost/9200"; do sleep 30; done
function echoKibanaLogs {
echo '--- Kibana logs'
if [[ "$TEST_PACKAGE" == "deb" ]] || [[ "$TEST_PACKAGE" == "rpm" ]]; then
vagrant ssh $TEST_PACKAGE -t -c 'sudo cat /var/log/kibana/kibana.log'
elif [[ "$TEST_PACKAGE" == "docker" ]]; then
vagrant ssh $TEST_PACKAGE -t -c 'sudo docker logs kibana'
fi
}
trap "echoKibanaLogs" EXIT
vagrant provision "$TEST_PACKAGE"
export TEST_BROWSER_HEADLESS=1