blob: 1aa8f2ce7349fb073c88f723017ffc690f7bf0dd [file] [log] [blame]
Joe Gordonc97f5c72013-02-14 01:15:57 +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
Joe Gordonc97f5c72013-02-14 01:15:57 +000018import subprocess
19
Matthew Treinish90aedd12013-02-25 17:56:49 -050020from oslo.config import cfg
Joe Gordonc97f5c72013-02-14 01:15:57 +000021import testtools
22
Sean Daguef6825792013-05-08 13:51:26 -040023import tempest.cli
Matthew Treinishf4a9b0f2013-07-26 16:58:26 -040024from tempest.openstack.common import log as logging
Giulio Fidente386ac8f2013-10-07 14:29:27 +020025import tempest.test
Joe Gordonc97f5c72013-02-14 01:15:57 +000026
27CONF = cfg.CONF
28
29
30LOG = logging.getLogger(__name__)
31
32
Sean Daguef6825792013-05-08 13:51:26 -040033class SimpleReadOnlyNovaClientTest(tempest.cli.ClientTestBase):
Joe Gordonc97f5c72013-02-14 01:15:57 +000034
35 """
36 This is a first pass at a simple read only python-novaclient test. This
37 only exercises client commands that are read only.
38
39 This should test commands:
40 * as a regular user
41 * as a admin user
42 * with and without optional parameters
43 * initially just check return codes, and later test command outputs
44
45 """
46
Joe Gordonc97f5c72013-02-14 01:15:57 +000047 def test_admin_fake_action(self):
48 self.assertRaises(subprocess.CalledProcessError,
49 self.nova,
50 'this-does-nova-exist')
51
Attila Fazekasc3a095b2013-08-17 09:15:44 +020052 # NOTE(jogo): Commands in order listed in 'nova help'
Joe Gordon34dc84d2013-02-21 02:19:23 +000053
54 # Positional arguments:
55
56 def test_admin_absolute_limites(self):
57 self.nova('absolute-limits')
Joe Gordon4edb6452013-03-05 21:18:59 +000058 self.nova('absolute-limits', params='--reserved')
Joe Gordon34dc84d2013-02-21 02:19:23 +000059
Joe Gordonc97f5c72013-02-14 01:15:57 +000060 def test_admin_aggregate_list(self):
61 self.nova('aggregate-list')
62
Joe Gordon34dc84d2013-02-21 02:19:23 +000063 def test_admin_availability_zone_list(self):
Joe Gordon4edb6452013-03-05 21:18:59 +000064 self.assertIn("internal", self.nova('availability-zone-list'))
Joe Gordon34dc84d2013-02-21 02:19:23 +000065
Joe Gordonc97f5c72013-02-14 01:15:57 +000066 def test_admin_cloudpipe_list(self):
67 self.nova('cloudpipe-list')
68
Joe Gordon34dc84d2013-02-21 02:19:23 +000069 def test_admin_credentials(self):
70 self.nova('credentials')
Joe Gordonc97f5c72013-02-14 01:15:57 +000071
Matthew Treinishfaa340d2013-07-19 16:26:21 -040072 @testtools.skipIf(CONF.service_available.neutron,
Ala Rezmerita15373b02013-07-19 15:45:10 +020073 "Neutron does not provide this feature")
Joe Gordonc97f5c72013-02-14 01:15:57 +000074 def test_admin_dns_domains(self):
75 self.nova('dns-domains')
76
Giulio Fidente386ac8f2013-10-07 14:29:27 +020077 @tempest.test.skip_because(bug="1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +000078 def test_admin_dns_list(self):
79 self.nova('dns-list')
80
81 def test_admin_endpoints(self):
82 self.nova('endpoints')
83
84 def test_admin_flavor_acces_list(self):
85 self.assertRaises(subprocess.CalledProcessError,
86 self.nova,
87 'flavor-access-list')
88 # Failed to get access list for public flavor type
89 self.assertRaises(subprocess.CalledProcessError,
90 self.nova,
91 'flavor-access-list',
92 params='--flavor m1.tiny')
93
Joe Gordonc97f5c72013-02-14 01:15:57 +000094 def test_admin_flavor_list(self):
Joe Gordon4edb6452013-03-05 21:18:59 +000095 self.assertIn("Memory_MB", self.nova('flavor-list'))
Joe Gordonc97f5c72013-02-14 01:15:57 +000096
Joe Gordon34dc84d2013-02-21 02:19:23 +000097 def test_admin_floating_ip_bulk_list(self):
98 self.nova('floating-ip-bulk-list')
99
100 def test_admin_floating_ip_list(self):
101 self.nova('floating-ip-list')
102
103 def test_admin_floating_ip_pool_list(self):
104 self.nova('floating-ip-pool-list')
105
106 def test_admin_host_list(self):
107 self.nova('host-list')
108
109 def test_admin_hypervisor_list(self):
110 self.nova('hypervisor-list')
111
112 def test_admin_image_list(self):
113 self.nova('image-list')
114
Giulio Fidente386ac8f2013-10-07 14:29:27 +0200115 @tempest.test.skip_because(bug="1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000116 def test_admin_interface_list(self):
117 self.nova('interface-list')
118
119 def test_admin_keypair_list(self):
120 self.nova('keypair-list')
121
122 def test_admin_list(self):
123 self.nova('list')
124 self.nova('list', params='--all-tenants 1')
125 self.nova('list', params='--all-tenants 0')
126 self.assertRaises(subprocess.CalledProcessError,
127 self.nova,
128 'list',
129 params='--all-tenants bad')
130
131 def test_admin_network_list(self):
132 self.nova('network-list')
133
134 def test_admin_rate_limits(self):
135 self.nova('rate-limits')
136
137 def test_admin_secgroup_list(self):
138 self.nova('secgroup-list')
139
Giulio Fidente386ac8f2013-10-07 14:29:27 +0200140 @tempest.test.skip_because(bug="1157349")
Joe Gordon34dc84d2013-02-21 02:19:23 +0000141 def test_admin_secgroup_list_rules(self):
142 self.nova('secgroup-list-rules')
143
144 def test_admin_servce_list(self):
145 self.nova('service-list')
146
147 def test_admin_usage(self):
148 self.nova('usage')
149
150 def test_admin_usage_list(self):
151 self.nova('usage-list')
152
153 def test_admin_volume_list(self):
154 self.nova('volume-list')
155
156 def test_admin_volume_snapshot_list(self):
157 self.nova('volume-snapshot-list')
158
159 def test_admin_volume_type_list(self):
160 self.nova('volume-type-list')
161
162 def test_admin_help(self):
163 self.nova('help')
164
165 def test_admin_list_extensions(self):
166 self.nova('list-extensions')
167
168 def test_admin_net_list(self):
169 self.nova('net-list')
170
wingwje5e318f2013-10-08 17:07:02 +0800171 def test_agent_list(self):
172 self.nova('agent-list')
173 self.nova('agent-list', flags='--debug')
174
Joe Gordon34dc84d2013-02-21 02:19:23 +0000175 # Optional arguments:
176
177 def test_admin_version(self):
178 self.nova('', flags='--version')
179
180 def test_admin_debug_list(self):
181 self.nova('list', flags='--debug')
182
183 def test_admin_timeout(self):
Matt Riedemannab038c92013-08-06 06:56:48 -0700184 self.nova('list', flags='--timeout %d' % CONF.cli.timeout)
Joe Gordon34dc84d2013-02-21 02:19:23 +0000185
186 def test_admin_timing(self):
187 self.nova('list', flags='--timing')