Skip to content

Commit ebea74f

Browse files
committed
[PGPRO-3182] Increase timeout to docker socket in tests.
Sometimes docker seems to randomly hang, see docker/compose#3927 tags: multimaster
1 parent 7eefe3b commit ebea74f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tests/lib/failure_injector.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import docker
2-
2+
import os
33

44
class FailureInjector(object):
55

66
def __init__(self, node=None):
7-
self.docker_api = docker.from_env()
7+
timeout = os.environ.get('DOCKER_CLIENT_TIMEOUT')
8+
if timeout is not None:
9+
timeout = int(timeout)
10+
self.docker_api = docker.from_env(timeout=timeout)
811

912
def container_exec(self, node, command):
1013
docker_node = self.docker_api.containers.get(node)

tests/lib/test_helper.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
2929
NODE_HOST = 'docker' if 'DOCKER_HOST' in os.environ else '127.0.0.1'
3030

31+
# sometimes docker seems to randomly hang for a default 60s, see
32+
# https://github.com/docker/compose/issues/3927
33+
# increase timeout in both compose in direct API calls
34+
os.environ['DOCKER_CLIENT_TIMEOUT'] = '180'
35+
os.environ['COMPOSE_HTTP_TIMEOUT'] = '180'
36+
3137
class MMTestCase(unittest.TestCase):
3238
@classmethod
3339
def collectLogs(cls, referee=False):

0 commit comments

Comments
 (0)