Skip to content
Snippets Groups Projects
Commit 86049b9d authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Merge branch 'fix-docker-pull' into 'master'

Fix docker-pull implementation

See merge request !57
parents 0936a76d 6e744310
No related branches found
No related tags found
1 merge request!57Fix docker-pull implementation
Pipeline #27520 passed
......@@ -269,14 +269,20 @@ class AsyncWithEnvironmentTest(unittest.TestCase):
cmd = ['python', '-c', '; '.join([
"print('Before')",
"import sys; sys.stdout.flush()",
"d = '0' * (10 * 1024 * 1024)",
"d = '0' * (40 * 1024 * 1024)",
"import time; time.sleep(5)",
"print('After')",
])
]
container = self.host.create_container(self.test_environment, cmd)
self.host.start(container, virtual_memory_in_megabytes=4)
# The amount of memory in megabytes should be greater than whatever
# the docker process is started with (see:
# https://unix.stackexchange.com/questions/412040/cgroups-memory-limit-write-error-device-or-resource-busy)
# If you start seeing EBUSY (device or resource busy errors) from
# docker, then try increasing a bit this value such that it still
# triggers the memory allocation error for the array defined above.
self.host.start(container, virtual_memory_in_megabytes=20)
time.sleep(2)
......@@ -313,7 +319,7 @@ class AsyncWithEnvironmentTest(unittest.TestCase):
assert stats['memory']['percent'] > 10, 'Memory check failed, ' \
'%d%% <= 10%%' % stats['memory']['percent']
assert stats['memory']['percent'] < 15, 'Memory check failed, ' \
assert stats['memory']['percent'] < 20, 'Memory check failed, ' \
'%d%% >= 15%%' % stats['memory']['percent']
self.assertEqual(self.host.status(container), 'exited')
......
......@@ -44,7 +44,9 @@ from . import network_name
from . import prefix_folder
from . import DOCKER_NETWORK_TEST_ENABLED
BUILDER_IMAGE = "docker.idiap.ch/beat/beat.env.client:2.0.0r0"
from .utils import DOCKER_TEST_IMAGES
BUILDER_CONTAINER_NAME = "docker.idiap.ch/beat/beat.env.client"
BUILDER_IMAGE = BUILDER_CONTAINER_NAME + ':' + DOCKER_TEST_IMAGES[BUILDER_CONTAINER_NAME]
#----------------------------------------------------------
......
......@@ -70,11 +70,12 @@ def pull_docker_test_images():
if not has_image: #must pull (network connection required)
token = os.environ.get('CI_BUILD_TOKEN')
params = (image, tag)
args = (image, tag)
kwargs = {}
if token is not None: #running on CI, setup
auth_config = dict(username='gitlab-ci-token', password=token)
params += (auth_config,)
client.images.pull(*params)
kwargs['auth_config'] = auth_config
client.images.pull(*args, **kwargs)
#----------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment