Merge "Fix openstack cluster resize"

This commit is contained in:
Jenkins
2016-06-16 09:28:37 +00:00
committed by Gerrit Code Review
2 changed files with 12 additions and 11 deletions

View File

@@ -425,14 +425,20 @@ class TestClusterResize(TestCluster):
self.assertEqual("Only one of 'capacity', 'adjustment' "
"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']
parsed_args = self.check_parser(self.cmd, arglist, [])
error = self.assertRaises(exc.CommandError,
self.cmd.take_action,
parsed_args)
self.assertEqual("At least one of 'capacity', 'adjustment' and "
"'percentage' should be specified.", str(error))
self.cmd.take_action(parsed_args)
kwargs = {
'min_size': 1,
'max_size': 20,
'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):
arglist = ['--capacity', '2', '--min-size', '1', '--max-size', '20',

View File

@@ -405,11 +405,6 @@ class ResizeCluster(command.Command):
raise exc.CommandError(_("Only one of 'capacity', 'adjustment' and"
" '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['number'] = None