Merge "Adding support for displaying cluster error details"

This commit is contained in:
Jenkins 2015-11-23 23:47:49 +00:00 committed by Gerrit Code Review
commit 20cba4a6ab
3 changed files with 39 additions and 2 deletions

View File

@ -57,6 +57,10 @@
"null"
],
"description": "Cluster volume"
},
"error_detail": {
"type": "string",
"description": "Cluster error description"
}
},

View File

@ -54,6 +54,18 @@ class V1(fixtures.Fixture):
"status": "BUILDING",
}
self.cluster_error = {
"name": "test-cluster3",
"id": "00000000-0000-0000-0000-000000008765",
"size": 3,
"network_id": ["05567na0-f7aa-6820-7afcd-7dd6e9963cd9"],
"created_at": "2015-01-01T00:00:00+00:00",
"endpoints": [],
"flavor": "1",
"status": "ERROR",
"error_detail": "cluster error detailed message",
}
self.new_cluster = {
"name": "new-test-cluster",
"id": "00000000-0000-0000-0000-000000009012",
@ -65,7 +77,7 @@ class V1(fixtures.Fixture):
"status": "BUILDING",
}
clusters = [self.cluster_1234, self.cluster_5678]
clusters = [self.cluster_1234, self.cluster_5678, self.cluster_error]
self.requests.register_uri('GET', self.url(),
json=clusters,

View File

@ -26,7 +26,10 @@ class TestListClusters(base.TestCueBase):
'test-cluster', 'ACTIVE', 1, []),
'00000000-0000-0000-0000-000000005678':
('00000000-0000-0000-0000-000000005678',
'test-cluster2', 'BUILDING', 3, [])}
'test-cluster2', 'BUILDING', 3, []),
'00000000-0000-0000-0000-000000008765':
('00000000-0000-0000-0000-000000008765',
'test-cluster3', 'ERROR', 3, [])}
result = self.execute(clusters.ListClustersCommand, arglist,
verifylist)
@ -55,6 +58,24 @@ class TestShowCluster(base.TestCueBase):
self.assert_called('GET', '/clusters/' + cluster_id)
self.assertEqual(expected, result)
def test_show_cluster_error(self):
"""test cluster show when in error state."""
cluster_id = '00000000-0000-0000-0000-000000008765'
arglist = [cluster_id]
verifylist = []
result = self.execute(clusters.ShowClusterCommand, arglist, verifylist)
expected = [('created_at', 'endpoints', 'error_detail', 'flavor', 'id',
'name', 'network_id', 'size', 'status'),
(u'2015-01-01T00:00:00+00:00', [],
'cluster error detailed message', '1',
'00000000-0000-0000-0000-000000008765',
'test-cluster3',
[u'05567na0-f7aa-6820-7afcd-7dd6e9963cd9'],
3, 'ERROR')]
self.assert_called('GET', '/clusters/' + cluster_id)
self.assertEqual(expected, result)
def test_show_cluster_without_id(self):
"""test show cluster without specifying cluster id"""