diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 0000000..ef4e1a9 --- /dev/null +++ b/bindep.txt @@ -0,0 +1 @@ +docker.io [platform:dpkg] diff --git a/craton/tests/functional/__init__.py b/craton/tests/functional/__init__.py index 9b4fa9b..87da5fc 100644 --- a/craton/tests/functional/__init__.py +++ b/craton/tests/functional/__init__.py @@ -7,6 +7,10 @@ from sqlalchemy import MetaData import testtools import threading +from oslo_log import log as logging + +LOG = logging.getLogger(__name__) + FAKE_DATA_GEN_USERNAME = 'demo' FAKE_DATA_GEN_TOKEN = 'demo' @@ -32,10 +36,12 @@ class DockerSetup(threading.Thread): if is_ok != 'OK': msg = 'Docker daemon ping failed.' self.error = msg + LOG.error(self.error) self.container_is_ready.set() return except Exception as err: self.error = err + LOG.error(self.error) self.container_is_ready.set() return @@ -45,6 +51,7 @@ class DockerSetup(threading.Thread): dockerfile='Dockerfile', pull=True, forcerm=True) + LOG.debug(build_output) output_last_line = "" for output_last_line in build_output: pass diff --git a/tools/test-setup.sh b/tools/test-setup.sh new file mode 100755 index 0000000..89e8b0b --- /dev/null +++ b/tools/test-setup.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# This script will execute before OpenStack infrastructure revokes sudo +# We need it to allow the Jenkins user to interact with docker + +# This tells docker to use the current user's primary group to run the unix +# domain socket for docker. This side-steps the need for the current user to +# be added to the docker group and then have to log out and back in. +sudo dd of=/lib/systemd/system/docker.socket << _EOF_ +[Unit] +Description=Docker Socket for the API +PartOf=docker.service + +[Socket] +ListenStream=/var/run/docker.sock +SocketMode=0660 +SocketUser=root +SocketGroup=$(id -gn) + +[Install] +WantedBy=sockets.target +_EOF_ + +echo "=> Restarting docker" +sudo systemctl daemon-reload +sudo systemctl restart docker + +echo "=> Checking permissions on the socket" +stat /var/run/docker.sock + +echo "=> Discovering docker version installed" +docker version