blob: 1e30978993338cfe17b52e79738565d05ca95c8a [file] [log] [blame]
Sergey Lukjanov582d1c62014-01-21 19:51:21 +04001# Copyright (c) 2013 Mirantis Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12# implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import logging
17import subprocess
18
19from tempest import cli
20from tempest import config
21from tempest import test
22
23CONF = config.CONF
24
25LOG = logging.getLogger(__name__)
26
27
28class SimpleReadOnlySavannaClientTest(cli.ClientTestBase):
29 """Basic, read-only tests for Savanna CLI client.
30
31 Checks return values and output of read-only commands.
32 These tests do not presume any content, nor do they create
33 their own. They only verify the structure of output if present.
34 """
35
36 @classmethod
37 def setUpClass(cls):
38 if not CONF.service_available.savanna:
39 msg = "Skipping all Savanna cli tests because it is not available"
40 raise cls.skipException(msg)
41 super(SimpleReadOnlySavannaClientTest, cls).setUpClass()
42
43 @test.attr(type='negative')
44 def test_savanna_fake_action(self):
45 self.assertRaises(subprocess.CalledProcessError,
46 self.savanna,
47 'this-does-not-exist')
48
49 def test_savanna_plugins_list(self):
50 plugins = self.parser.listing(self.savanna('plugin-list'))
51 self.assertTableStruct(plugins, ['name', 'versions', 'title'])
52
53 def test_savanna_plugins_show(self):
54 plugin = self.parser.listing(self.savanna('plugin-show',
55 params='--name vanilla'))
56 self.assertTableStruct(plugin, ['Property', 'Value'])
57
58 def test_savanna_node_group_template_list(self):
59 plugins = self.parser.listing(self.savanna('node-group-template-list'))
60 self.assertTableStruct(plugins, ['name', 'id', 'plugin_name',
61 'node_processes', 'description'])
62
63 def test_savanna_cluster_template_list(self):
64 plugins = self.parser.listing(self.savanna('cluster-template-list'))
65 self.assertTableStruct(plugins, ['name', 'id', 'plugin_name',
66 'node_groups', 'description'])
67
68 def test_savanna_cluster_list(self):
69 plugins = self.parser.listing(self.savanna('cluster-list'))
70 self.assertTableStruct(plugins, ['name', 'id', 'status', 'node_count'])