summaryrefslogtreecommitdiffstats
path: root/docs/how-to-use/APITests.rst
blob: 599325ff8457800c7411070752c7a2c24d117033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
SNAPS OpenStack API Testing
===========================

Tests designated as component tests extend the snaps.openstack.tests.OSComponentTestCase class and must be exercised
with OpenStack credentials for all as well as an external network for many. When leveraging the unit\_test\_suite.py
application, the -e argument and -n arguments will suffice. When attempting to execute these tests within your IDE
of choice (tested on IntelliJ), you will need to edit the [repo\_dir]/snaps/openstack/tests/conf/os\_env.yaml file as well
as ensuring that your run configuration's working directory is set to [repo\_dir]/snaps.

The Test Classes
================

glance_utils_tests.py - GlanceSmokeTests
----------------------------------------

Ensures that a Glance client can be obtained as well as the proper
exceptions thrown with the wrong credentials.

keystone_utils_tests.py - KeystoneSmokeTests
--------------------------------------------

Ensures that a Keystone client can be obtained as well as the proper
exceptions thrown with the wrong credentials.

neutron_utils_tests.py - NeutronSmokeTests
------------------------------------------

Ensures that a Neutron client can be obtained as well as the proper
exceptions thrown with the wrong credentials.

nova_utils_tests.py - NovaSmokeTests
------------------------------------

Ensures that a Nova client can be obtained as well as the proper
exceptions thrown with the wrong credentials.

keystone_utils_tests.py - KeystoneUtilsTests
--------------------------------------------

+----------------------------------+---------------+-----------------------------------------------------------+
| Test Name                        | Keystone API  | Description                                               |
+==================================+===============+===========================================================+
| test_create_user_minimal         | 2 & 3         | Tests the creation of a user with minimal configuration   |
|                                  |               | settings via the utility functions                        |
+----------------------------------+---------------+-----------------------------------------------------------+
| test_create_project_minimal      | 2 & 3         | Tests the creation of a project with minimal configuration|
|                                  |               | settings via the utility functions                        |
+----------------------------------+---------------+-----------------------------------------------------------+

create_user_tests.py - CreateUserSuccessTests
---------------------------------------------
+----------------------------------+---------------+-----------------------------------------------------------+
| Test Name                        | Keystone API  | Description                                               |
+==================================+===============+===========================================================+
| test_create_user                 | 2 & 3         | Tests the creation of a user with minimal configuration   |
|                                  |               | settings via the utility functions                        |
+----------------------------------+---------------+-----------------------------------------------------------+

create_project_tests.py - CreateProjectSuccessTests
---------------------------------------------------

+----------------------------------+---------------+-----------------------------------------------------------+
| Test Name                        | Keystone API  | Description                                               |
+==================================+===============+===========================================================+
| test_create_user_minimal         | 2 & 3         | Tests the creation of a user via the OpenStackUser class  |
+----------------------------------+---------------+-----------------------------------------------------------+
| test_create_user_2x              | 2 & 3         | Tests the creation of a user a second time via the        |
|                                  |               | OpenStackUser class to ensure it is only created once     |
+----------------------------------+---------------+-----------------------------------------------------------+
| test_create_delete_user          | 2 & 3         | Tests the creation and deletion of a user via the         |
|                                  |               | OpenStackUser class to ensure that clean will not raise   |
|                                  |               | an exception                                              |
+----------------------------------+---------------+-----------------------------------------------------------+

create_project_tests.py - CreateProjectUserTests
------------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Keystone API  | Description                                               |
+=======================================+===============+===========================================================+
| test_create_project_sec_grp_one_user  | 2 & 3         | Tests the creation of an OpenStack object to a project    |
|                                       |               | with a new users and to create a security group           |
|                                       |               |                                                           |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_project_sec_grp_two_users | 2 & 3         | Tests the creation of an OpenStack object to a project    |
|                                       |               | with two new users and to create a security group under   |
|                                       |               | each                                                      |
+---------------------------------------+---------------+-----------------------------------------------------------+

glance_utils_tests.py - GlanceUtilsTests
------------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Glance API    | Description                                               |
+=======================================+===============+===========================================================+
| test_create_image_minimal_url         | 1             | Tests the glance_utils.create_image() function with a URL |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_image_minimal_file        | 1             | Tests the glance_utils.create_image() function with a file|
+---------------------------------------+---------------+-----------------------------------------------------------+

neutron_utils_tests.py - NeutronUtilsNetworkTests
-------------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Neutron API   | Description                                               |
+=======================================+===============+===========================================================+
| test_create_network                   | 2             | Ensures neutron_utils.create_network() properly creates a |
|                                       |               | network                                                   |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_network_empty_name        | 2             | Ensures neutron_utils.create_network() raises an exception|
|                                       |               | when the network name is an empty string                  |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_network_null_name         | 2             | Ensures neutron_utils.create_network() raises an exception|
|                                       |               | when the network name is None                             |
+---------------------------------------+---------------+-----------------------------------------------------------+

neutron_utils_tests.py - NeutronUtilsSubnetTests
------------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Neutron API   | Description                                               |
+=======================================+===============+===========================================================+
| test_create_subnet                    | 2             | Ensures neutron_utils.create_subnet() can properly create |
|                                       |               | an OpenStack subnet object                                |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_subnet_null_name          | 2             | Ensures neutron_utils.create_subnet() raises an exception |
|                                       |               | when the subnet name is None                              |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_subnet_empty_name         | 2             | Ensures neutron_utils.create_subnet() raises an exception |
|                                       |               | when the subnet name is an empty string                   |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_subnet_null_cidr          | 2             | Ensures neutron_utils.create_subnet() raises an exception |
|                                       |               | when the subnet CIDR is None                              |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_subnet_empty_cidr         | 2             | Ensures neutron_utils.create_subnet() raises an exception |
|                                       |               | when the subnet CIDR is an empty string                   |
+---------------------------------------+---------------+-----------------------------------------------------------+

neutron_utils_tests.py - NeutronUtilsRouterTests
------------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Neutron API   | Description                                               |
+=======================================+===============+===========================================================+
| test_create_router_simple             | 2             | Ensures neutron_utils.create_router() can properly create |
|                                       |               | a simple OpenStack router object                          |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_router_with_public_inter  | 2             | Ensures neutron_utils.create_router() can properly create |
| face                                  |               | an OpenStack router object with an interface to the       |
|                                       |               | external network                                          |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_router_empty_name         | 2             | Ensures neutron_utils.create_router() raises an exception |
|                                       |               | when the name is an empty string                          |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_router_null_name          | 2             | Ensures neutron_utils.create_router() raises an exception |
|                                       |               | when the name is None                                     |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_add_interface_router             | 2             | Ensures neutron_utils.add_interface_router() properly adds|
|                                       |               | an interface to another subnet                            |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_add_interface_router_null_router | 2             | Ensures neutron_utils.add_interface_router() raises an    |
|                                       |               | exception when the router object is None                  |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_add_interface_router_null_subnet | 2             | Ensures neutron_utils.add_interface_router() raises an    |
|                                       |               | exception when the subnet object is None                  |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_port                      | 2             | Ensures neutron_utils.create_port() can properly create an|
|                                       |               | OpenStack port object                                     |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_port_empty_name           | 2             | Ensures neutron_utils.create_port() raises an exception   |
|                                       |               | when the port name is an empty string                     |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_port_null_name            | 2             | Ensures neutron_utils.create_port() raises an exception   |
|                                       |               | when the port name is None                                |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_port_null_network_object  | 2             | Ensures neutron_utils.create_port() raises an exception   |
|                                       |               | when the network object is None                           |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_port_null_ip              | 2             | Ensures neutron_utils.create_port() raises an exception   |
|                                       |               | when the assigned IP value is None                        |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_port_invalid_ip           | 2             | Ensures neutron_utils.create_port() raises an exception   |
|                                       |               | when the assigned IP value is invalid                     |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_port_invalid_ip_to_subnet | 2             | Ensures neutron_utils.create_port() raises an exception   |
|                                       |               | when the assigned IP value is not part of CIDR            |
+---------------------------------------+---------------+-----------------------------------------------------------+

neutron_utils_tests.py - NeutronUtilsSecurityGroupTests
-------------------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Neutron API   | Description                                               |
+=======================================+===============+===========================================================+
| test_create_delete_simple_sec_grp     | 2             | Ensures that a security group can be created              |
|                                       |               | (neutron_utils.create_security_group() and deleted via    |
|                                       |               | neutron_utils.delete_security_group()                     |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_sec_grp_no_name           | 2             | Ensures that neutron_utils.create_security_group() raises |
|                                       |               | an exception when attempting to create a security group   |
|                                       |               | without a name                                            |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_sec_grp_no_rules          | 2             | Ensures that neutron_utils.create_security_group() can    |
|                                       |               | create a security group without any rules                 |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_sec_grp_one_rule          | 2             | Ensures that neutron_utils.create_security_group_rule()   |
|                                       |               | can add a rule to a security group                        |
+---------------------------------------+---------------+-----------------------------------------------------------+

nova_utils_tests.py - NovaUtilsKeypairTests
-------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Nova API      | Description                                               |
+=======================================+===============+===========================================================+
| test_create_keypair                   | 2             | Ensures that a keypair can be properly created via        |
|                                       |               | nova_utils.upload_keypair() with a public_key object      |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_delete_keypair            | 2             | Ensures that a keypair can be properly deleted via        |
|                                       |               | nova_utils.delete_keypair()                               |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_key_from_file             | 2             | Ensures that a keypair can be properly created via        |
|                                       |               | nova_utils.upload_keypair_file()                          |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_floating_ips                     | 2             | Ensures that a floating IP can be properly created via    |
|                                       |               | nova_utils.create_floating_ip() [note: this test should   |
|                                       |               | be moved to a new class]                                  |
+---------------------------------------+---------------+-----------------------------------------------------------+

nova_utils_tests.py - NovaUtilsFlavorTests
------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Nova API      | Description                                               |
+=======================================+===============+===========================================================+
| test_create_flavor                    | 2             | Ensures that a flavor can be properly created via         |
|                                       |               | nova_utils.create_flavor()                                |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_delete_flavor             | 2             | Ensures that a flavor can be properly deleted via         |
|                                       |               | nova_utils.delete_flavor()                                |
+---------------------------------------+---------------+-----------------------------------------------------------+

create_flavor_tests.py - CreateFlavorTests
------------------------------------------

+---------------------------------------+---------------+-----------------------------------------------------------+
| Test Name                             | Nova API      | Description                                               |
+=======================================+===============+===========================================================+
| test_create_flavor                    | 2             | Ensures that the OpenStackFlavor class's create() method  |
|                                       |               | creates an OpenStack flavor object                        |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_flavor_existing           | 2             | Ensures that the OpenStackFlavor class's create() will not|
|                                       |               | create a flavor with the same name more than once         |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_clean_flavor              | 2             | Ensures that the OpenStackFlavor class's clean() method   |
|                                       |               | will delete the flavor object                             |
+---------------------------------------+---------------+-----------------------------------------------------------+
| test_create_delete_flavor             | 2             | Ensures that the OpenStackFlavor class's clean() method   |
|                                       |               | will not raise an exception when called and the object no |
|                                       |               | longer exists                                             |
+---------------------------------------+---------------+-----------------------------------------------------------+