Skip to content

Commit

Permalink
[PGPRO-3182] Increase timeout to docker socket in tests.
Browse files Browse the repository at this point in the history
Sometimes docker seems to randomly hang, see
docker/compose#3927

tags: multimaster
  • Loading branch information
arssher committed Oct 21, 2020
1 parent 7eefe3b commit ebea74f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/lib/failure_injector.py
@@ -1,10 +1,13 @@
import docker

import os

class FailureInjector(object):

def __init__(self, node=None):
self.docker_api = docker.from_env()
timeout = os.environ.get('DOCKER_CLIENT_TIMEOUT')
if timeout is not None:
timeout = int(timeout)
self.docker_api = docker.from_env(timeout=timeout)

def container_exec(self, node, command):
docker_node = self.docker_api.containers.get(node)
Expand Down
6 changes: 6 additions & 0 deletions tests/lib/test_helper.py
Expand Up @@ -28,6 +28,12 @@
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
NODE_HOST = 'docker' if 'DOCKER_HOST' in os.environ else '127.0.0.1'

# sometimes docker seems to randomly hang for a default 60s, see
# https://github.com/docker/compose/issues/3927
# increase timeout in both compose in direct API calls
os.environ['DOCKER_CLIENT_TIMEOUT'] = '180'
os.environ['COMPOSE_HTTP_TIMEOUT'] = '180'

class MMTestCase(unittest.TestCase):
@classmethod
def collectLogs(cls, referee=False):
Expand Down

0 comments on commit ebea74f

Please sign in to comment.