diff --git a/senlinclient/tests/unit/v1/test_cluster.py b/senlinclient/tests/unit/v1/test_cluster.py index 6495ea06..bb741df4 100644 --- a/senlinclient/tests/unit/v1/test_cluster.py +++ b/senlinclient/tests/unit/v1/test_cluster.py @@ -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', diff --git a/senlinclient/v1/cluster.py b/senlinclient/v1/cluster.py index ebb0a6dc..3ceef5f4 100644 --- a/senlinclient/v1/cluster.py +++ b/senlinclient/v1/cluster.py @@ -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