File 0001-interfaces_by_fixed_ip-no-extra-port.patch of Package openstack-tempest

From d2c426faa402ca2c9184374a9b273f963b5f6760 Mon Sep 17 00:00:00 2001
From: Attila Fazekas <afazekas@redhat.com>
Date: Sun, 4 Nov 2018 12:40:27 +0100
Subject: [PATCH] interfaces_by_fixed_ip no extra port

test_create_list_show_delete_interfaces_by_fixed_ip was allowed
to make one extra port/interface creation optional
in case the CONF.compute.fixed_network_name was defined,
but in this case the test failed at teardown time (double port delete).
Turned out the test case normally not even deletes the fixed_ip port,
inside the test case.

There is no point for having 3 interface in this test, so just
adding/deleting the fixed_ip interface
and removing th 3th `extra` interface part from the test.

The extra port was problematic in (multiple) shared network case,
however fixed_ip interface creation part
has the right logic to use an explicit network.

Related-Bug: #1790864
Change-Id: I6e3e53c4ac26b4fef09fefb9c590dfa91f577565
(cherry picked from commit 3588bb3f5ef546a0ef4d4ad621fd1be381b5fdaf)
---
 .../api/compute/servers/test_attach_interfaces.py | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 7509ac6db..15280bb8d 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -23,6 +23,7 @@ from tempest.common import utils
 from tempest.common.utils import net_utils
 from tempest.common import waiters
 from tempest import config
+from tempest.lib.common.utils import test_utils
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
 
@@ -140,7 +141,9 @@ class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
         iface = self.interfaces_client.create_interface(
             server['id'], net_id=network_id,
             fixed_ips=fixed_ips)['interfaceAttachment']
-        self.addCleanup(self.ports_client.delete_port, iface['port_id'])
+        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
+                        self.ports_client.delete_port,
+                        iface['port_id'])
         self._check_interface(iface, server_id=server['id'],
                               fixed_ip=ip_list[0])
         return iface
@@ -232,16 +235,6 @@ class AttachInterfacesTestJSON(base.BaseV2ComputeTest):
         interface_count = len(ifs)
         self.assertGreater(interface_count, 0)
 
-        try:
-            iface = self._test_create_interface(server)
-        except lib_exc.BadRequest as e:
-            msg = ('Multiple possible networks found, use a Network ID to be '
-                   'more specific.')
-            if not CONF.compute.fixed_network_name and six.text_type(e) == msg:
-                raise
-        else:
-            ifs.append(iface)
-
         iface = self._test_create_interface_by_fixed_ips(server, ifs)
         ifs.append(iface)
 
-- 
2.21.0

openSUSE Build Service is sponsored by