diff options
| author | Joffrey F <f.joffrey@gmail.com> | 2015-09-09 14:54:19 -0700 |
|---|---|---|
| committer | Joffrey F <f.joffrey@gmail.com> | 2015-09-09 14:54:19 -0700 |
| commit | cfbc967c846d151952f2a9972eceeb2510bd1813 (patch) | |
| tree | 20ec5fe547948e406e324f5dc8518b664b3fd2d6 | |
| parent | 0ef8c0459d1ee444befd01bf758c40a723958e09 (diff) | |
| parent | fa3082b6cd46cd486bb38ca4e266ff489f6dff94 (diff) | |
| download | docker-py-cfbc967c846d151952f2a9972eceeb2510bd1813.tar.gz | |
Merge pull request #757 from docker/756-containerized-integration
Containerized Integration
| -rw-r--r-- | .dockerignore | 1 | ||||
| -rw-r--r-- | Makefile | 10 | ||||
| -rw-r--r-- | tests/integration_test.py | 7 | ||||
| -rw-r--r-- | tests/utils_test.py | 8 |
4 files changed, 21 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 @@ -4,6 +4,9 @@ HOST_TMPDIR=test -n "$(TMPDIR)" && echo $(TMPDIR) || echo /tmp all: test +clean: + docker rm -vf dpy-dind + build: docker build -t docker-py . @@ -23,3 +26,10 @@ 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-dind: build build-py3 + docker build -t dpy-tests -f ./tests/Dockerfile . + docker run -d --name dpy-dind -v /tmp --privileged dockerswarm/dind:1.8.1 docker -d -H tcp://0.0.0.0:2375 + docker run --volumes-from dpy-dind --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-py py.test -rxs tests/integration_test.py + docker run --volumes-from dpy-dind --env="DOCKER_HOST=tcp://docker:2375" --link=dpy-dind:docker docker-py3 py.test -rxs tests/integration_test.py + docker rm -vf dpy-dind 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']) |
