Skip to content

Commit 1fb2db4

Browse files
committed
Make integration tests more CI-friendly.
Signed-off-by: Joffrey F <[email protected]>
1 parent cfbc967 commit 1fb2db4

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ integration-test-py3: build-py3
2828
docker run -v `$(HOST_TMPDIR)`:/tmp -v /var/run/docker.sock:/var/run/docker.sock docker-py3 py.test -rxs tests/integration_test.py
2929

3030
integration-dind: build build-py3
31-
docker build -t dpy-tests -f ./tests/Dockerfile .
3231
docker run -d --name dpy-dind -v /tmp --privileged dockerswarm/dind:1.8.1 docker -d -H tcp://0.0.0.0:2375
3332
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
3433
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

tests/integration_test.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def setUp(self):
8282
if six.PY2:
8383
self.assertRegex = self.assertRegexpMatches
8484
self.assertCountEqual = self.assertItemsEqual
85-
self.client = docker_client(timeout=5)
85+
self.client = docker_client(timeout=60)
8686
self.tmp_imgs = []
8787
self.tmp_containers = []
8888
self.tmp_folders = []
@@ -1115,38 +1115,34 @@ def runTest(self):
11151115

11161116
class TestPull(BaseTestCase):
11171117
def runTest(self):
1118-
self.client.close()
1119-
self.client = docker_client(timeout=10)
11201118
try:
1121-
self.client.remove_image('busybox')
1119+
self.client.remove_image('hello-world')
11221120
except docker.errors.APIError:
11231121
pass
1124-
res = self.client.pull('busybox')
1122+
res = self.client.pull('hello-world')
11251123
self.assertEqual(type(res), six.text_type)
11261124
self.assertGreaterEqual(
1127-
len(self.client.images('busybox')), 1
1125+
len(self.client.images('hello-world')), 1
11281126
)
1129-
img_info = self.client.inspect_image('busybox')
1127+
img_info = self.client.inspect_image('hello-world')
11301128
self.assertIn('Id', img_info)
11311129

11321130

11331131
class TestPullStream(BaseTestCase):
11341132
def runTest(self):
1135-
self.client.close()
1136-
self.client = docker_client(timeout=10)
11371133
try:
1138-
self.client.remove_image('busybox')
1134+
self.client.remove_image('hello-world')
11391135
except docker.errors.APIError:
11401136
pass
1141-
stream = self.client.pull('busybox', stream=True)
1137+
stream = self.client.pull('hello-world', stream=True)
11421138
for chunk in stream:
11431139
if six.PY3:
11441140
chunk = chunk.decode('utf-8')
11451141
json.loads(chunk) # ensure chunk is a single, valid JSON blob
11461142
self.assertGreaterEqual(
1147-
len(self.client.images('busybox')), 1
1143+
len(self.client.images('hello-world')), 1
11481144
)
1149-
img_info = self.client.inspect_image('busybox')
1145+
img_info = self.client.inspect_image('hello-world')
11501146
self.assertIn('Id', img_info)
11511147

11521148

@@ -1195,9 +1191,7 @@ def runTest(self):
11951191
class ImportTestCase(BaseTestCase):
11961192
'''Base class for `docker import` test cases.'''
11971193

1198-
# Use a large file size to increase the chance of triggering any
1199-
# MemoryError exceptions we might hit.
1200-
TAR_SIZE = 512 * 1024 * 1024
1194+
TAR_SIZE = 512 * 1024
12011195

12021196
def write_dummy_tar_content(self, n_bytes, tar_fd):
12031197
def extend_file(f, n_bytes):

0 commit comments

Comments
 (0)