Merge "Fix spelling error on get_docker_quantity method"
This commit is contained in:
@@ -56,7 +56,7 @@ def validate_sort_dir(sort_dir):
|
||||
def validate_docker_memory(mem_str):
|
||||
"""Docker require that Minimum memory limit >= 4M."""
|
||||
try:
|
||||
mem = utils.get_docker_quanity(mem_str)
|
||||
mem = utils.get_docker_quantity(mem_str)
|
||||
except exception.UnsupportedDockerQuantityFormat:
|
||||
raise wsme.exc.ClientSideError(_("Invalid docker memory specified. "
|
||||
"Acceptable values are format: "
|
||||
|
||||
@@ -574,7 +574,7 @@ def get_k8s_quantity(quantity):
|
||||
raise exception.UnsupportedK8sQuantityFormat()
|
||||
|
||||
|
||||
def get_docker_quanity(quantity):
|
||||
def get_docker_quantity(quantity):
|
||||
"""This function is used to get swarm Memory quantity.
|
||||
|
||||
Memory format must be in the format of:
|
||||
|
||||
@@ -88,7 +88,7 @@ class Handler(object):
|
||||
if container.memory is not None:
|
||||
kwargs['host_config'] = {
|
||||
'Memory':
|
||||
magnum_utils.get_docker_quanity(container.memory)}
|
||||
magnum_utils.get_docker_quantity(container.memory)}
|
||||
else:
|
||||
kwargs['mem_limit'] = container.memory
|
||||
|
||||
|
||||
@@ -132,17 +132,17 @@ class UtilsTestCase(base.TestCase):
|
||||
self.assertRaises(exception.UnsupportedK8sQuantityFormat,
|
||||
utils.get_k8s_quantity, '1E1E')
|
||||
|
||||
def test_get_docker_quanity(self):
|
||||
self.assertEqual(512, utils.get_docker_quanity('512'))
|
||||
self.assertEqual(512, utils.get_docker_quanity('512b'))
|
||||
self.assertEqual(512 * 1024, utils.get_docker_quanity('512k'))
|
||||
self.assertEqual(512 * 1024 * 1024, utils.get_docker_quanity('512m'))
|
||||
def test_get_docker_quantity(self):
|
||||
self.assertEqual(512, utils.get_docker_quantity('512'))
|
||||
self.assertEqual(512, utils.get_docker_quantity('512b'))
|
||||
self.assertEqual(512 * 1024, utils.get_docker_quantity('512k'))
|
||||
self.assertEqual(512 * 1024 * 1024, utils.get_docker_quantity('512m'))
|
||||
self.assertEqual(512 * 1024 * 1024 * 1024,
|
||||
utils.get_docker_quanity('512g'))
|
||||
utils.get_docker_quantity('512g'))
|
||||
self.assertRaises(exception.UnsupportedDockerQuantityFormat,
|
||||
utils.get_docker_quanity, '512bb')
|
||||
utils.get_docker_quantity, '512bb')
|
||||
self.assertRaises(exception.UnsupportedDockerQuantityFormat,
|
||||
utils.get_docker_quanity, '512B')
|
||||
utils.get_docker_quantity, '512B')
|
||||
|
||||
|
||||
class ExecuteTestCase(base.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user