blob: cd819a43da46486a3abbc1a6624ee560e2df9183 [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
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040028class SimpleReadOnlySaharaClientTest(cli.ClientTestBase):
29 """Basic, read-only tests for Sahara CLI client.
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040030
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):
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040038 if not CONF.service_available.sahara:
39 msg = "Skipping all Sahara cli tests because it is not available"
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040040 raise cls.skipException(msg)
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040041 super(SimpleReadOnlySaharaClientTest, cls).setUpClass()
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040042
43 @test.attr(type='negative')
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040044 def test_sahara_fake_action(self):
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040045 self.assertRaises(subprocess.CalledProcessError,
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040046 self.sahara,
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040047 'this-does-not-exist')
48
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040049 def test_sahara_plugins_list(self):
50 plugins = self.parser.listing(self.sahara('plugin-list'))
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040051 self.assertTableStruct(plugins, ['name', 'versions', 'title'])
52
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040053 def test_sahara_plugins_show(self):
54 plugin = self.parser.listing(self.sahara('plugin-show',
55 params='--name vanilla'))
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040056 self.assertTableStruct(plugin, ['Property', 'Value'])
57
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040058 def test_sahara_node_group_template_list(self):
59 plugins = self.parser.listing(self.sahara('node-group-template-list'))
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040060 self.assertTableStruct(plugins, ['name', 'id', 'plugin_name',
61 'node_processes', 'description'])
62
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040063 def test_sahara_cluster_template_list(self):
64 plugins = self.parser.listing(self.sahara('cluster-template-list'))
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040065 self.assertTableStruct(plugins, ['name', 'id', 'plugin_name',
66 'node_groups', 'description'])
67
Sergey Lukjanov9c95a252014-03-13 23:59:22 +040068 def test_sahara_cluster_list(self):
69 plugins = self.parser.listing(self.sahara('cluster-list'))
Sergey Lukjanov582d1c62014-01-21 19:51:21 +040070 self.assertTableStruct(plugins, ['name', 'id', 'status', 'node_count'])