Fix NameError exception
The test_allocate_floating_ip can fail with "NameError:
name 'floating_ip_id_allocated' is not defined" if the
client.create_floating_ip call or response return fail.
Change-Id: I2db82ecf560c7d868ca9ab765a4fd751946b45f0
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index ff7188b..f1d5568 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -64,10 +64,10 @@
def test_allocate_floating_ip(self):
# Positive test:Allocation of a new floating IP to a project
# should be successful
+ resp, body = self.client.create_floating_ip()
+ self.assertEqual(200, resp.status)
+ floating_ip_id_allocated = body['id']
try:
- resp, body = self.client.create_floating_ip()
- self.assertEqual(200, resp.status)
- floating_ip_id_allocated = body['id']
resp, floating_ip_details = \
self.client.get_floating_ip_details(floating_ip_id_allocated)
# Checking if the details of allocated IP is in list of floating IP