diff options
| author | Joffrey F <joffrey@docker.com> | 2015-09-08 17:43:57 -0700 |
|---|---|---|
| committer | Joffrey F <joffrey@docker.com> | 2015-09-09 14:49:36 -0700 |
| commit | abaf346b49277004399bf7308de28e2ee012739c (patch) | |
| tree | e0c136f3ea2ed1f2849b50aed636b9984f60d5b5 | |
| parent | 2dfab762241fa5f9d88dc785cf7fcf0a3e2dff8a (diff) | |
| download | docker-py-abaf346b49277004399bf7308de28e2ee012739c.tar.gz | |
Make running integration tests with dind possible
| -rw-r--r-- | .dockerignore | 1 | ||||
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | tests/Dockerfile | 18 | ||||
| -rw-r--r-- | tests/integration_test.py | 7 | ||||
| -rw-r--r-- | tests/utils_test.py | 8 |
5 files changed, 33 insertions, 5 deletions
diff --git a/.dockerignore b/.dockerignore index c767879..a1e09df 100644 --- a/.dockerignore +++ b/.dockerignore @@ -14,3 +14,4 @@ tests/__pycache__ # Compiled Documentation site/ +Makefile @@ -23,3 +23,7 @@ integration-test: build integration-test-py3: build-py3 docker run -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py3 py.test -rxs tests/integration_test.py + +integration-ci: + docker build -t dpy-tests -f ./tests/Dockerfile . + docker run --privileged -t dpy-tests diff --git a/tests/Dockerfile b/tests/Dockerfile new file mode 100644 index 0000000..576af4a --- /dev/null +++ b/tests/Dockerfile @@ -0,0 +1,18 @@ +FROM dockerswarm/dind:1.8.1 +MAINTAINER Joffrey F <joffrey@docker.com> + +RUN mkdir /home/docker-py +WORKDIR /home/docker-py + +RUN apt-get update && apt-get install -y python python-setuptools && easy_install pip + +ADD requirements.txt /home/docker-py/requirements.txt +RUN pip install -r requirements.txt + +ADD test-requirements.txt /home/docker-py/test-requirements.txt +RUN pip install -r test-requirements.txt + +ADD . /home/docker-py +RUN pip install -U . + +CMD ["bash", "-c", "docker daemon 2>/dev/null & py.test -rxs tests/integration_test.py"]
\ No newline at end of file diff --git a/tests/integration_test.py b/tests/integration_test.py index fd4ff2d..e63504b 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -190,7 +190,6 @@ class TestCreateContainer(BaseTestCase): class TestCreateContainerWithBinds(BaseTestCase): - @pytest.mark.skipif(True, reason="Doesn't work inside a container - FIXME") def runTest(self): mount_dest = '/mnt' mount_origin = tempfile.mkdtemp() @@ -233,7 +232,6 @@ class TestCreateContainerWithBinds(BaseTestCase): class TestCreateContainerWithRoBinds(BaseTestCase): - @pytest.mark.skipif(True, reason="Doesn't work inside a container - FIXME") def runTest(self): mount_dest = '/mnt' mount_origin = tempfile.mkdtemp() @@ -1461,8 +1459,11 @@ class TestBuildWithDockerignore(Cleanup, BaseTestCase): self.client.wait(c) logs = self.client.logs(c) + if six.PY3: + logs = logs.decode('utf-8') + self.assertEqual( - filter(None, logs.split('\n')), + list(filter(None, logs.split('\n'))), ['not-ignored'], ) diff --git a/tests/utils_test.py b/tests/utils_test.py index 7ce888b..b67ac4e 100644 --- a/tests/utils_test.py +++ b/tests/utils_test.py @@ -234,14 +234,18 @@ class UtilsTest(base.BaseTestCase): def test_create_host_config_dict_logconfig(self): dct = {'type': LogConfig.types.SYSLOG, 'config': {'key1': 'val1'}} - config = create_host_config(log_config=dct) + config = create_host_config( + version=DEFAULT_DOCKER_API_VERSION, log_config=dct + ) self.assertIn('LogConfig', config) self.assertTrue(isinstance(config['LogConfig'], LogConfig)) self.assertEqual(dct['type'], config['LogConfig'].type) def test_create_host_config_obj_logconfig(self): obj = LogConfig(type=LogConfig.types.SYSLOG, config={'key1': 'val1'}) - config = create_host_config(log_config=obj) + config = create_host_config( + version=DEFAULT_DOCKER_API_VERSION, log_config=obj + ) self.assertIn('LogConfig', config) self.assertTrue(isinstance(config['LogConfig'], LogConfig)) self.assertEqual(obj, config['LogConfig']) |
