diff --git a/test/runner/lib/config.py b/test/runner/lib/config.py index b1f23954fe..3b422d274c 100644 --- a/test/runner/lib/config.py +++ b/test/runner/lib/config.py @@ -46,6 +46,7 @@ class EnvironmentConfig(CommonConfig): self.docker_util = docker_qualify_image(args.docker_util if 'docker_util' in args else '') # type: str self.docker_pull = args.docker_pull if 'docker_pull' in args else False # type: bool self.docker_keep_git = args.docker_keep_git if 'docker_keep_git' in args else False # type: bool + self.docker_memory = args.docker_memory if 'docker_memory' in args else None self.tox_sitepackages = args.tox_sitepackages # type: bool diff --git a/test/runner/lib/delegation.py b/test/runner/lib/delegation.py index 17cd46c0af..356773a17e 100644 --- a/test/runner/lib/delegation.py +++ b/test/runner/lib/delegation.py @@ -216,6 +216,12 @@ def delegate_docker(args, exclude, require): '--privileged=%s' % str(privileged).lower(), ] + if args.docker_memory: + test_options.extend([ + '--memory=%d' % args.docker_memory, + '--memory-swap=0', + ]) + docker_socket = '/var/run/docker.sock' if os.path.exists(docker_socket): diff --git a/test/runner/test.py b/test/runner/test.py index d8719161cc..79f4f0ff29 100755 --- a/test/runner/test.py +++ b/test/runner/test.py @@ -605,6 +605,9 @@ def add_extra_docker_options(parser, integration=True): action='store_true', help='run docker container in privileged mode') + docker.add_argument('--docker-memory', + help='memory limit for docker in bytes', type=int) + def complete_target(prefix, parsed_args, **_): """