diff --git a/.travis.yml b/.travis.yml
index b4d4692..532ae77 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,10 +18,6 @@ after_success: if [[ $TOXENV =~ py..-(full|pytest3) ]]; then codecov; fi
 
 jobs:
   include:
-    - env: TOXENV=py34-core,py34-pytest,py34-testtools,py34-full
-      python: '3.4'
-      services: docker
-
     - env: TOXENV=py35-core,py35-pytest,py35-testtools,py35-full
       python: '3.5'
       services: docker
diff --git a/seaworthy/containers/rabbitmq.py b/seaworthy/containers/rabbitmq.py
index a4e3c4b..12b095a 100644
--- a/seaworthy/containers/rabbitmq.py
+++ b/seaworthy/containers/rabbitmq.py
@@ -20,9 +20,11 @@ class RabbitMQContainer(ContainerDefinition):
        Write more docs.
     """
 
-    # For some reason this container is slower to start through seaworthy than
-    # with a plain `docker run`, so give it a bit more time to get going. :-(
-    WAIT_TIMEOUT = 20.0
+    # There seems to be a weird interaction between the erlang runtime and
+    # something in docker which results in annoyingly long startup times in
+    # some environments. The best we can do to deal with that is to give it a
+    # bit more time to get going. :-(
+    WAIT_TIMEOUT = 30.0
 
     DEFAULT_NAME = 'rabbitmq'
     DEFAULT_IMAGE = 'rabbitmq:alpine'
@@ -51,6 +53,14 @@ class RabbitMQContainer(ContainerDefinition):
         self.user = user
         self.password = password
 
+    def wait_for_start(self):
+        """
+        Wait for the RabbitMQ process to be come up.
+        """
+        er = self.exec_rabbitmqctl(
+            'wait', ['--pid', '1', '--timeout', str(int(self.wait_timeout))])
+        output_lines(er, error_exc=TimeoutError)
+
     def base_kwargs(self):
         """
         Add a ``tmpfs`` entry for ``/var/lib/rabbitmq`` to avoid unnecessary
diff --git a/seaworthy/utils.py b/seaworthy/utils.py
index c2b1637..4eaa548 100644
--- a/seaworthy/utils.py
+++ b/seaworthy/utils.py
@@ -1,7 +1,7 @@
 from docker.models.containers import ExecResult
 
 
-def output_lines(output, encoding='utf-8'):
+def output_lines(output, encoding='utf-8', error_exc=None):
     """
     Convert bytestring container output or the result of a container exec
     command into a sequence of unicode lines.
@@ -9,12 +9,19 @@ def output_lines(output, encoding='utf-8'):
     :param output:
         Container output bytes or an
         :class:`docker.models.containers.ExecResult` instance.
-    :param encoding: The encoding to use when converting bytes to unicode
+    :param encoding:
+        The encoding to use when converting bytes to unicode
         (default ``utf-8``).
+    :param error_exc:
+        Optional exception to raise if ``output`` is an ``ExecResult`` with a
+        nonzero exit code.
 
     :returns: list[str]
+
     """
     if isinstance(output, ExecResult):
-        _, output = output
+        exit_code, output = output
+        if exit_code != 0 and error_exc is not None:
+            raise error_exc(output.decode(encoding))
 
     return output.decode(encoding).splitlines()

Use `rabbitmqctl wait` to wait for RabbitMQ containers to start
https://www.rabbitmq.com/rabbitmqctl.8.html#wait
diff --git a/seaworthy/tests-core/test_utils.py b/seaworthy/tests-core/test_utils.py
index 0067627..66c5260 100644
--- a/seaworthy/tests-core/test_utils.py
+++ b/seaworthy/tests-core/test_utils.py
@@ -18,3 +18,10 @@ class TestOutputLinesFunc(unittest.TestCase):
     def test_custom_encoding(self):
         """String lines can be parsed using a custom encoding."""
         self.assertEqual(output_lines(b'\xe1', encoding='latin1'), ['á'])
+
+    def test_exec_result_error_exc(self):
+        """ExecResult with nonzero exit code can raise exception."""
+        with self.assertRaisesRegex(TimeoutError, 'x\r\ny'):
+            output_lines(ExecResult(128, b'x\r\ny'), error_exc=TimeoutError)
+        # No exception if the exit code is zero.
+        self.assertEqual(output_lines(ExecResult(0, b':-)')), [':-)'])

pip install -e .[test,docstest,pep8test]
parse_log_pytest
requirements.txt
apt-get update apt-get install -y gcc
3.7
dev-requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
attrs==24.2.0
Babel==2.14.0
bleach==6.0.0
cachetools==5.5.2
certifi @ file:///croot/certifi_1671487769961/work/certifi
chardet==5.2.0
charset-normalizer==3.4.1
colorama==0.4.6
coverage==7.2.7
distlib==0.3.9
doc8==1.0.0
docker==3.7.3
docker-pycreds==0.4.0
docutils==0.20.1
exceptiongroup==1.2.2
filelock==3.12.2
flake8==5.0.4
flake8-import-order==0.18.2
hyperlink==21.0.0
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
iniconfig==2.0.0
Jinja2==3.1.6
MarkupSafe==2.1.5
mccabe==0.7.0
packaging==24.0
pbr==6.1.1
pep8-naming==0.14.0
platformdirs==4.0.0
pluggy==1.2.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.17.2
pyproject-api==1.5.3
pytest==7.4.4
pytz==2025.2
PyYAML==6.0.1
readme-renderer==37.3
requests==2.31.0
responses==0.23.3
restructuredtext-lint==1.4.0
-e git+https://github.com/praekeltfoundation/seaworthy.git@8f59b021f885a2ef894faa1b9b6ca6a623c11b39#egg=seaworthy
six==1.17.0
snowballstemmer==2.2.0
Sphinx==1.7.9
sphinx-rtd-theme==0.5.1
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-websupport==1.2.4
stevedore==3.5.2
testtools==2.7.1
tomli==2.0.1
tox==4.8.0
types-PyYAML==6.0.12.12
typing_extensions==4.7.1
urllib3==2.0.7
virtualenv==20.26.6
webencodings==0.5.1
websocket-client==1.6.1
zipp==3.15.0

name: seaworthy
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==24.2.0
      - babel==2.14.0
      - bleach==6.0.0
      - cachetools==5.5.2
      - chardet==5.2.0
      - charset-normalizer==3.4.1
      - colorama==0.4.6
      - coverage==7.2.7
      - distlib==0.3.9
      - doc8==1.0.0
      - docker==3.7.3
      - docker-pycreds==0.4.0
      - docutils==0.20.1
      - exceptiongroup==1.2.2
      - filelock==3.12.2
      - flake8==5.0.4
      - flake8-import-order==0.18.2
      - hyperlink==21.0.0
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.2.0
      - iniconfig==2.0.0
      - jinja2==3.1.6
      - markupsafe==2.1.5
      - mccabe==0.7.0
      - packaging==24.0
      - pbr==6.1.1
      - pep8-naming==0.14.0
      - platformdirs==4.0.0
      - pluggy==1.2.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pygments==2.17.2
      - pyproject-api==1.5.3
      - pytest==7.4.4
      - pytz==2025.2
      - pyyaml==6.0.1
      - readme-renderer==37.3
      - requests==2.31.0
      - responses==0.23.3
      - restructuredtext-lint==1.4.0
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==1.7.9
      - sphinx-rtd-theme==0.5.1
      - sphinxcontrib-serializinghtml==1.1.5
      - sphinxcontrib-websupport==1.2.4
      - stevedore==3.5.2
      - testtools==2.7.1
      - tomli==2.0.1
      - tox==4.8.0
      - types-pyyaml==6.0.12.12
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - virtualenv==20.26.6
      - webencodings==0.5.1
      - websocket-client==1.6.1
      - zipp==3.15.0
prefix: /opt/conda/envs/seaworthy

seaworthy/tests-core/test_utils.py::TestOutputLinesFunc::test_exec_result_error_exc
seaworthy/tests-core/test_utils.py::TestOutputLinesFunc::test_bytes seaworthy/tests-core/test_utils.py::TestOutputLinesFunc::test_custom_encoding seaworthy/tests-core/test_utils.py::TestOutputLinesFunc::test_exec_result
.travis.yml seaworthy/utils.py seaworthy/containers/rabbitmq.py
.travis.yml seaworthy/utils.py seaworthy/containers/rabbitmq.py