Skip to content

Commit cfbc967

Browse files
committed
Merge pull request #757 from docker/756-containerized-integration
Containerized Integration
2 parents 0ef8c04 + fa3082b commit cfbc967

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ tests/__pycache__
1414

1515
# Compiled Documentation
1616
site/
17+
Makefile

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ HOST_TMPDIR=test -n "$(TMPDIR)" && echo $(TMPDIR) || echo /tmp
44

55
all: test
66

7+
clean:
8+
docker rm -vf dpy-dind
9+
710
build:
811
docker build -t docker-py .
912

@@ -23,3 +26,10 @@ integration-test: build
2326

2427
integration-test-py3: build-py3
2528
docker run -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py3 py.test -rxs tests/integration_test.py
29+
30+
integration-dind: build build-py3
31+
docker build -t dpy-tests -f ./tests/Dockerfile .
32+
docker run -d --name dpy-dind -v /tmp --privileged dockerswarm/dind:1.8.1 docker -d -H tcp://0.0.0.0:2375
33+
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
34+
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
35+
docker rm -vf dpy-dind

tests/integration_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ def runTest(self):
190190

191191

192192
class TestCreateContainerWithBinds(BaseTestCase):
193-
@pytest.mark.skipif(True, reason="Doesn't work inside a container - FIXME")
194193
def runTest(self):
195194
mount_dest = '/mnt'
196195
mount_origin = tempfile.mkdtemp()
@@ -233,7 +232,6 @@ def runTest(self):
233232

234233

235234
class TestCreateContainerWithRoBinds(BaseTestCase):
236-
@pytest.mark.skipif(True, reason="Doesn't work inside a container - FIXME")
237235
def runTest(self):
238236
mount_dest = '/mnt'
239237
mount_origin = tempfile.mkdtemp()
@@ -1461,8 +1459,11 @@ def runTest(self):
14611459
self.client.wait(c)
14621460
logs = self.client.logs(c)
14631461

1462+
if six.PY3:
1463+
logs = logs.decode('utf-8')
1464+
14641465
self.assertEqual(
1465-
filter(None, logs.split('\n')),
1466+
list(filter(None, logs.split('\n'))),
14661467
['not-ignored'],
14671468
)
14681469

tests/utils_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,18 @@ def test_ulimit_invalid_type(self):
234234

235235
def test_create_host_config_dict_logconfig(self):
236236
dct = {'type': LogConfig.types.SYSLOG, 'config': {'key1': 'val1'}}
237-
config = create_host_config(log_config=dct)
237+
config = create_host_config(
238+
version=DEFAULT_DOCKER_API_VERSION, log_config=dct
239+
)
238240
self.assertIn('LogConfig', config)
239241
self.assertTrue(isinstance(config['LogConfig'], LogConfig))
240242
self.assertEqual(dct['type'], config['LogConfig'].type)
241243

242244
def test_create_host_config_obj_logconfig(self):
243245
obj = LogConfig(type=LogConfig.types.SYSLOG, config={'key1': 'val1'})
244-
config = create_host_config(log_config=obj)
246+
config = create_host_config(
247+
version=DEFAULT_DOCKER_API_VERSION, log_config=obj
248+
)
245249
self.assertIn('LogConfig', config)
246250
self.assertTrue(isinstance(config['LogConfig'], LogConfig))
247251
self.assertEqual(obj, config['LogConfig'])

0 commit comments

Comments
 (0)