Merge "fix wrong attribute in heat senlin client"

This commit is contained in:
Zuul 2023-03-17 06:20:24 +00:00 committed by Gerrit Code Review
commit d07d22e26b
4 changed files with 26 additions and 24 deletions

View File

@ -232,7 +232,7 @@ class Cluster(res_base.BaseSenlinResource):
'enabled': p[self.P_ENABLED],
}
action = {
'func': 'cluster_attach_policy',
'func': 'attach_policy_to_cluster',
'params': params,
'action_id': None,
'done': False,
@ -283,7 +283,7 @@ class Cluster(res_base.BaseSenlinResource):
'enabled': p[self.P_ENABLED]
}
action = {
'func': 'cluster_update_policy',
'func': 'update_cluster_policy',
'params': params,
'action_id': None,
'done': False,
@ -296,7 +296,7 @@ class Cluster(res_base.BaseSenlinResource):
'enabled': p[self.P_ENABLED]
}
action = {
'func': 'cluster_detach_policy',
'func': 'detach_policy_from_cluster',
'params': params,
'action_id': None,
'done': False,
@ -309,7 +309,7 @@ class Cluster(res_base.BaseSenlinResource):
'enabled': p[self.P_ENABLED]
}
action = {
'func': 'cluster_attach_policy',
'func': 'attach_policy_to_cluster',
'params': params,
'action_id': None,
'done': False,
@ -338,7 +338,7 @@ class Cluster(res_base.BaseSenlinResource):
params['number'] = params.pop(self.DESIRED_CAPACITY)
params['cluster'] = self.resource_id
action = {
'func': 'cluster_resize',
'func': 'resize_cluster',
'params': params,
'action_id': None,
'done': False,

View File

@ -156,7 +156,7 @@ class Node(res_base.BaseSenlinResource):
'nodes': [self.resource_id],
}
action = {
'func': 'cluster_del_nodes',
'func': 'remove_nodes_from_cluster',
'action_id': None,
'params': params,
'done': False,
@ -179,7 +179,7 @@ class Node(res_base.BaseSenlinResource):
'nodes': [self.resource_id],
}
action = {
'func': 'cluster_add_nodes',
'func': 'add_nodes_to_cluster',
'action_id': None,
'params': params,
'done': False,

View File

@ -144,7 +144,7 @@ class SenlinClusterTest(common.HeatTestCase):
}
self.senlin_mock.create_cluster.assert_called_once_with(
**create_cluster_kwargs)
self.senlin_mock.cluster_attach_policy.assert_called_once_with(
self.senlin_mock.attach_policy_to_cluster.assert_called_once_with(
**attach_policy_kwargs)
def test_cluster_create_error(self):
@ -216,7 +216,7 @@ class SenlinClusterTest(common.HeatTestCase):
props['desired_capacity'] = 10
rsrc_defns = template.Template(new_t).resource_definitions(self.stack)
new_cluster = rsrc_defns['senlin-cluster']
self.senlin_mock.cluster_resize.return_value = {
self.senlin_mock.resize_cluster.return_value = {
'action': 'fake-action'}
self.senlin_mock.get_action.return_value = mock.Mock(
status='SUCCEEDED')
@ -226,7 +226,7 @@ class SenlinClusterTest(common.HeatTestCase):
'adjustment_type': 'EXACT_CAPACITY',
'number': 10
}
self.senlin_mock.cluster_resize.assert_called_once_with(
self.senlin_mock.resize_cluster.assert_called_once_with(
cluster=cluster.resource_id, **cluster_resize_kwargs)
self.assertEqual(2, self.senlin_mock.get_action.call_count)
@ -243,9 +243,9 @@ class SenlinClusterTest(common.HeatTestCase):
props['policies'] = [{'policy': 'new_policy'}]
rsrc_defns = template.Template(new_t).resource_definitions(self.stack)
new_cluster = rsrc_defns['senlin-cluster']
self.senlin_mock.cluster_detach_policy.return_value = {
self.senlin_mock.detach_policy_from_cluster.return_value = {
'action': 'fake-action'}
self.senlin_mock.cluster_attach_policy.return_value = {
self.senlin_mock.attach_policy_to_cluster.return_value = {
'action': 'fake-action'}
self.senlin_mock.get_action.return_value = mock.Mock(
status='SUCCEEDED')
@ -257,10 +257,10 @@ class SenlinClusterTest(common.HeatTestCase):
'enabled': True,
}
self.assertEqual(2,
self.senlin_mock.cluster_attach_policy.call_count)
self.senlin_mock.cluster_detach_policy.assert_called_once_with(
self.senlin_mock.attach_policy_to_cluster.call_count)
self.senlin_mock.detach_policy_from_cluster.assert_called_once_with(
**detach_policy_kwargs)
self.assertEqual(0, self.senlin_mock.cluster_update_policy.call_count)
self.assertEqual(0, self.senlin_mock.update_cluster_policy.call_count)
self.assertEqual(3, self.senlin_mock.get_action.call_count)
def test_cluster_update_policy_exists(self):
@ -270,7 +270,7 @@ class SenlinClusterTest(common.HeatTestCase):
props['policies'] = [{'policy': 'fake_policy', 'enabled': False}]
rsrc_defns = template.Template(new_t).resource_definitions(self.stack)
new_cluster = rsrc_defns['senlin-cluster']
self.senlin_mock.cluster_update_policy.return_value = {
self.senlin_mock.update_cluster_policy.return_value = {
'action': 'fake-action'}
self.senlin_mock.get_action.return_value = mock.Mock(
status='SUCCEEDED')
@ -281,10 +281,12 @@ class SenlinClusterTest(common.HeatTestCase):
'cluster': cluster.resource_id,
'enabled': False,
}
self.senlin_mock.cluster_update_policy.assert_called_once_with(
self.senlin_mock.update_cluster_policy.assert_called_once_with(
**update_policy_kwargs)
self.assertEqual(1, self.senlin_mock.cluster_attach_policy.call_count)
self.assertEqual(0, self.senlin_mock.cluster_detach_policy.call_count)
self.assertEqual(1, self.senlin_mock.
attach_policy_to_cluster.call_count)
self.assertEqual(0, self.senlin_mock.
detach_policy_from_cluster.call_count)
def test_cluster_update_failed(self):
cluster = self._create_cluster(self.t)
@ -293,7 +295,7 @@ class SenlinClusterTest(common.HeatTestCase):
props['desired_capacity'] = 3
rsrc_defns = template.Template(new_t).resource_definitions(self.stack)
update_snippet = rsrc_defns['senlin-cluster']
self.senlin_mock.cluster_resize.return_value = {
self.senlin_mock.resize_cluster.return_value = {
'action': 'fake-action'}
self.senlin_mock.get_action.return_value = mock.Mock(
status='FAILED', status_reason='Unknown')

View File

@ -180,17 +180,17 @@ class SenlinNodeTest(common.HeatTestCase):
props['cluster'] = 'new_cluster'
rsrc_defns = template.Template(new_t).resource_definitions(self.stack)
new_node = rsrc_defns['senlin-node']
self.senlin_mock.cluster_del_nodes.return_value = {
self.senlin_mock.remove_nodes_from_cluster.return_value = {
'action': 'remove_node_from_cluster'
}
self.senlin_mock.cluster_add_nodes.return_value = {
self.senlin_mock.add_nodes_to_cluster.return_value = {
'action': 'add_node_to_cluster'
}
scheduler.TaskRunner(node.update, new_node)()
self.assertEqual((node.UPDATE, node.COMPLETE), node.state)
self.senlin_mock.cluster_del_nodes.assert_called_once_with(
self.senlin_mock.remove_nodes_from_cluster.assert_called_once_with(
cluster='fake_cluster_id', nodes=[node.resource_id])
self.senlin_mock.cluster_add_nodes.assert_called_once_with(
self.senlin_mock.add_nodes_to_cluster.assert_called_once_with(
cluster='new_cluster_id', nodes=[node.resource_id])
def test_node_update_failed(self):