summaryrefslogtreecommitdiff
path: root/saharaclient/tests
diff options
context:
space:
mode:
authorAndrey Pavlov <apavlov@mirantis.com>2015-12-07 14:26:05 +0300
committerAndrey Pavlov <apavlov@mirantis.com>2015-12-22 14:08:55 +0000
commit261a964698bdf3f5a73808416b9968da69b9c4de (patch)
tree3cc623e832e516065ee50ce26ef612d223cdb942 /saharaclient/tests
parentc419d7400ca1cad13f1b13fd1b8e040e71266904 (diff)
downloadpython-saharaclient-261a964698bdf3f5a73808416b9968da69b9c4de.tar.gz
Fixing cluster scaling via CLI
If a cluster had a node group with a name different than a node group template name and you wanted to resize it via CLI, cluster wasn't able to be scaled. Change-Id: I554d9c07741dcb2077f9ecd0f6b5dbce65c6a464 Closes-bug: #1523455
Diffstat (limited to 'saharaclient/tests')
-rw-r--r--saharaclient/tests/unit/osc/v1/test_clusters.py29
1 files changed, 20 insertions, 9 deletions
diff --git a/saharaclient/tests/unit/osc/v1/test_clusters.py b/saharaclient/tests/unit/osc/v1/test_clusters.py
index b88738c..b7f6a6a 100644
--- a/saharaclient/tests/unit/osc/v1/test_clusters.py
+++ b/saharaclient/tests/unit/osc/v1/test_clusters.py
@@ -35,7 +35,8 @@ CLUSTER_INFO = {
"id": "ng_id",
"name": "fakeng",
"plugin_name": 'fake',
- "hadoop_version": '0.1'
+ "hadoop_version": '0.1',
+ "node_group_template_id": 'ngt_id'
}
],
"hadoop_version": "0.1",
@@ -59,6 +60,11 @@ CT_INFO = {
"id": "ct_id"
}
+NGT_INFO = {
+ 'id': 'ngt_id',
+ 'name': 'fakeng'
+}
+
class TestClusters(fakes.TestDataProcessing):
def setUp(self):
@@ -404,10 +410,11 @@ class TestScaleCluster(TestClusters):
def test_cluster_scale_resize(self):
self.ngt_mock.find_unique.return_value = api_ngt.NodeGroupTemplate(
- None, CLUSTER_INFO['node_groups'][0])
- arglist = ['fake', '--node-groups', 'fakeng:1']
+ None, NGT_INFO)
+ arglist = ['fake', '--instances', 'fakeng:1']
- verifylist = [('cluster', 'fake'), ('node_groups', ['fakeng:1'])]
+ verifylist = [('cluster', 'fake'),
+ ('instances', ['fakeng:1'])]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -416,7 +423,10 @@ class TestScaleCluster(TestClusters):
# Check that correct arguments were passed
self.cl_mock.scale.assert_called_once_with(
'cluster_id',
- {'resize_node_groups': [{'count': 1, 'name': 'fakeng'}]})
+ {'resize_node_groups': [
+ {'count': 1,
+ 'name': 'fakeng'}]}
+ )
# Check that columns are correct
expected_columns = ('Anti affinity', 'Cluster template id',
@@ -438,18 +448,19 @@ class TestScaleCluster(TestClusters):
new_ng = {'name': 'new', 'id': 'new_id'}
self.ngt_mock.find_unique.return_value = api_ngt.NodeGroupTemplate(
None, new_ng)
- arglist = ['fake', '--node-groups', 'fakeng:1']
+ arglist = ['fake', '--instances', 'new:1']
- verifylist = [('cluster', 'fake'), ('node_groups', ['fakeng:1'])]
+ verifylist = [('cluster', 'fake'), ('instances', ['new:1'])]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
- columns, data = self.cmd.take_action(parsed_args)
+ self.cmd.take_action(parsed_args)
# Check that correct arguments were passed
self.cl_mock.scale.assert_called_once_with(
'cluster_id',
{'add_node_groups': [
- {'count': 1, 'node_group_template_id': 'new_id',
+ {'count': 1,
+ 'node_group_template_id': 'new_id',
'name': 'new'}
]})