Commit ef754e5f authored by André Anjos's avatar André Anjos 💬

[test][test_docker] Reset container memory limit to a higher value

This commit resets the container memory limit on the memory-limit test
to a higher value.  It turns out that Docker-18.09 is complaining it
cannot set the memory of the container in question to 4 Mb, possibly
because it starts up with more than that memory already (see discussion
about this here:
https://unix.stackexchange.com/questions/412040/cgroups-memory-limit-write-error-device-or-resource-busy).  Increasing the container memory to 10 Mb
and to the allocated array to 20 Mb makes the test work again.
parent 0f041982
Pipeline #27500 failed with stage
in 19 minutes and 57 seconds
......@@ -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' * (20 * 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=10)
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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment