Added unit tests for container limits in build

This commit is contained in:
Joffrey F 2015-04-27 16:36:15 -07:00
parent ae329cb3ac
commit 7958110fda
1 changed files with 19 additions and 0 deletions

View File

@ -2254,6 +2254,25 @@ class DockerClientTest(Cleanup, base.BaseTestCase):
except Exception as e:
self.fail('Command should not raise exception: {0}'.format(e))
def test_build_container_with_container_limits(self):
try:
self.client.build('.', container_limits={
'memory': 1024 * 1024,
'cpusetcpus': 1,
'cpushares': 1000,
'memswap': 1024 * 1024 * 8
})
except Exception as e:
self.fail('Command should not raise exception: {0}'.format(e))
def test_build_container_invalid_container_limits(self):
self.assertRaises(
docker.errors.DockerException,
lambda: self.client.build('.', container_limits={
'foo': 'bar'
})
)
#######################
# PY SPECIFIC TESTS #
#######################