Merge "Fix openstack cluster resize"
This commit is contained in:
@@ -425,14 +425,20 @@ class TestClusterResize(TestCluster):
|
|||||||
self.assertEqual("Only one of 'capacity', 'adjustment' "
|
self.assertEqual("Only one of 'capacity', 'adjustment' "
|
||||||
"and 'percentage' can be specified.", str(error))
|
"and 'percentage' can be specified.", str(error))
|
||||||
|
|
||||||
def test_cluster_resize_none_params(self):
|
def test_cluster_resize_only_constraints(self):
|
||||||
arglist = ['--min-size', '1', '--max-size', '20', 'my_cluster']
|
arglist = ['--min-size', '1', '--max-size', '20', 'my_cluster']
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, [])
|
parsed_args = self.check_parser(self.cmd, arglist, [])
|
||||||
error = self.assertRaises(exc.CommandError,
|
self.cmd.take_action(parsed_args)
|
||||||
self.cmd.take_action,
|
kwargs = {
|
||||||
parsed_args)
|
'min_size': 1,
|
||||||
self.assertEqual("At least one of 'capacity', 'adjustment' and "
|
'max_size': 20,
|
||||||
"'percentage' should be specified.", str(error))
|
'adjustment_type': None,
|
||||||
|
'min_step': None,
|
||||||
|
'number': None,
|
||||||
|
'strict': False
|
||||||
|
}
|
||||||
|
self.mock_client.cluster_resize.assert_called_with('my_cluster',
|
||||||
|
**kwargs)
|
||||||
|
|
||||||
def test_cluster_resize_capacity(self):
|
def test_cluster_resize_capacity(self):
|
||||||
arglist = ['--capacity', '2', '--min-size', '1', '--max-size', '20',
|
arglist = ['--capacity', '2', '--min-size', '1', '--max-size', '20',
|
||||||
|
@@ -405,11 +405,6 @@ class ResizeCluster(command.Command):
|
|||||||
raise exc.CommandError(_("Only one of 'capacity', 'adjustment' and"
|
raise exc.CommandError(_("Only one of 'capacity', 'adjustment' and"
|
||||||
" 'percentage' can be specified."))
|
" 'percentage' can be specified."))
|
||||||
|
|
||||||
if sum(v is None for v in (capacity, adjustment, percentage)) == 3:
|
|
||||||
raise exc.CommandError(_("At least one of 'capacity', "
|
|
||||||
"'adjustment' and 'percentage' "
|
|
||||||
"should be specified."))
|
|
||||||
|
|
||||||
action_args['adjustment_type'] = None
|
action_args['adjustment_type'] = None
|
||||||
action_args['number'] = None
|
action_args['number'] = None
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user