Kaydet (Commit) 1fb2db49 authored tarafından Joffrey F's avatar Joffrey F

Make integration tests more CI-friendly.

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst cfbc967c
......@@ -28,7 +28,6 @@ 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
......
......@@ -82,7 +82,7 @@ class BaseTestCase(unittest.TestCase):
if six.PY2:
self.assertRegex = self.assertRegexpMatches
self.assertCountEqual = self.assertItemsEqual
self.client = docker_client(timeout=5)
self.client = docker_client(timeout=60)
self.tmp_imgs = []
self.tmp_containers = []
self.tmp_folders = []
......@@ -1115,38 +1115,34 @@ class TestRemoveLink(BaseTestCase):
class TestPull(BaseTestCase):
def runTest(self):
self.client.close()
self.client = docker_client(timeout=10)
try:
self.client.remove_image('busybox')
self.client.remove_image('hello-world')
except docker.errors.APIError:
pass
res = self.client.pull('busybox')
res = self.client.pull('hello-world')
self.assertEqual(type(res), six.text_type)
self.assertGreaterEqual(
len(self.client.images('busybox')), 1
len(self.client.images('hello-world')), 1
)
img_info = self.client.inspect_image('busybox')
img_info = self.client.inspect_image('hello-world')
self.assertIn('Id', img_info)
class TestPullStream(BaseTestCase):
def runTest(self):
self.client.close()
self.client = docker_client(timeout=10)
try:
self.client.remove_image('busybox')
self.client.remove_image('hello-world')
except docker.errors.APIError:
pass
stream = self.client.pull('busybox', stream=True)
stream = self.client.pull('hello-world', stream=True)
for chunk in stream:
if six.PY3:
chunk = chunk.decode('utf-8')
json.loads(chunk) # ensure chunk is a single, valid JSON blob
self.assertGreaterEqual(
len(self.client.images('busybox')), 1
len(self.client.images('hello-world')), 1
)
img_info = self.client.inspect_image('busybox')
img_info = self.client.inspect_image('hello-world')
self.assertIn('Id', img_info)
......@@ -1195,9 +1191,7 @@ class TestRemoveImage(BaseTestCase):
class ImportTestCase(BaseTestCase):
'''Base class for `docker import` test cases.'''
# Use a large file size to increase the chance of triggering any
# MemoryError exceptions we might hit.
TAR_SIZE = 512 * 1024 * 1024
TAR_SIZE = 512 * 1024
def write_dummy_tar_content(self, n_bytes, tar_fd):
def extend_file(f, n_bytes):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment