Skip to content

Commit 7958110

Browse files
committed
Added unit tests for container limits in build
1 parent ae329cb commit 7958110

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,6 +2254,25 @@ def test_build_container_with_named_dockerfile(self):
22542254
except Exception as e:
22552255
self.fail('Command should not raise exception: {0}'.format(e))
22562256

2257+
def test_build_container_with_container_limits(self):
2258+
try:
2259+
self.client.build('.', container_limits={
2260+
'memory': 1024 * 1024,
2261+
'cpusetcpus': 1,
2262+
'cpushares': 1000,
2263+
'memswap': 1024 * 1024 * 8
2264+
})
2265+
except Exception as e:
2266+
self.fail('Command should not raise exception: {0}'.format(e))
2267+
2268+
def test_build_container_invalid_container_limits(self):
2269+
self.assertRaises(
2270+
docker.errors.DockerException,
2271+
lambda: self.client.build('.', container_limits={
2272+
'foo': 'bar'
2273+
})
2274+
)
2275+
22572276
#######################
22582277
# PY SPECIFIC TESTS #
22592278
#######################

0 commit comments

Comments
 (0)