blob: 5768c7468b6595dacd60c63826944ee4baff98ad [file] [log] [blame]
Joe Gordon4edb6452013-03-05 21:18:59 +00001# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2013 OpenStack Foundation
4# All Rights Reserved.
5#
6# Licensed under the Apache License, Version 2.0 (the "License"); you may
7# not use this file except in compliance with the License. You may obtain
8# a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15# License for the specific language governing permissions and limitations
16# under the License.
17
18import logging
19import subprocess
20
21import testtools
22
23import cli
24
25
26LOG = logging.getLogger(__name__)
27
28
29class SimpleReadOnlyNovaManageTest(cli.ClientTestBase):
30
31 """
32 This is a first pass at a simple read only nova-manage test. This
33 only exercises client commands that are read only.
34
35 This should test commands:
36 * with and without optional parameters
37 * initially just check return codes, and later test command outputs
38
39 """
40
41 def test_admin_fake_action(self):
42 self.assertRaises(subprocess.CalledProcessError,
43 self.nova_manage,
44 'this-does-nova-exist')
45
46 #NOTE(jogo): Commands in order listed in 'nova-manage -h'
47
48 # test flags
49 def test_help_flag(self):
50 self.nova_manage('', '-h')
51
Joe Gordon4edb6452013-03-05 21:18:59 +000052 def test_version_flag(self):
53 self.assertNotEqual("", self.nova_manage('', '--version'))
Joe Gordon488057a2013-03-14 22:26:50 +000054 self.assertEqual(self.nova_manage('version'),
55 self.nova_manage('', '--version'))
56
57 def test_debug_flag(self):
58 self.assertNotEqual("", self.nova_manage('instance_type list',
59 '--debug'))
60
61 def test_verbose_flag(self):
62 self.assertNotEqual("", self.nova_manage('instance_type list',
63 '--verbose'))
Joe Gordon4edb6452013-03-05 21:18:59 +000064
65 # test actions
66 def test_version(self):
67 self.assertNotEqual("", self.nova_manage('version'))
68
69 def test_flavor_list(self):
70 self.assertNotEqual("", self.nova_manage('flavor list'))
Joe Gordon488057a2013-03-14 22:26:50 +000071 self.assertNotEqual(self.nova_manage('instance_type list'),
72 self.nova_manage('flavor list'))
73
74 def test_db_archive_deleted_rows(self):
75 # make sure command doesn't error out
76 self.nova_manage('db archive_deleted_rows 50')
77
78 def test_db_sync(self):
79 # make sure command doesn't error out
80 self.nova_manage('db sync')
81
82 def test_db_version(self):
83 self.assertNotEqual("", self.nova_manage('db version'))