diff options
author | Omer Katz <omer.drow@gmail.com> | 2019-03-19 09:55:19 +0200 |
---|---|---|
committer | Omer Katz <omer.drow@gmail.com> | 2019-03-19 09:55:19 +0200 |
commit | befd27092675e116e6c0c839a02ed9b6d761c98c (patch) | |
tree | 5539a0e6ef8d0445c5d74961efaa18654e64d066 | |
parent | f08e2106eed9878e73d7d553473226d9c74c7d3d (diff) | |
download | py-amqp-befd27092675e116e6c0c839a02ed9b6d761c98c.tar.gz |
Display rabbitmq logs on failure.
-rwxr-xr-x | rabbitmq_logs.sh | 12 | ||||
-rw-r--r-- | t/integration/conftest.py | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/rabbitmq_logs.sh b/rabbitmq_logs.sh new file mode 100755 index 0000000..387a0b0 --- /dev/null +++ b/rabbitmq_logs.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +containers=$(sudo docker ps -q | tail -n +1) + +for item in ${containers//\\n/} +do + env=$(sudo docker inspect -f '{{range $index, $value := .Config.Env}}{{$value}} {{end}}' $item); + if [[ $env == *"PYAMQP_INTEGRATION_INSTANCE=1"* ]]; then + grep -m1 'Server startup complete' <(sudo docker logs -f $item) + sudo docker logs $item + fi +done; diff --git a/t/integration/conftest.py b/t/integration/conftest.py new file mode 100644 index 0000000..271e680 --- /dev/null +++ b/t/integration/conftest.py @@ -0,0 +1,7 @@ +import os +import subprocess + +def pytest_sessionfinish(session, exitstatus): + tox_env_dir = os.environ.get('TOX_WORK_DIR') + if exitstatus and tox_env_dir: + subprocess.call(["bash", "./rabbitmq_logs.sh"]) |