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
This commit is contained in:
Attila Fazekas 2018-11-04 12:40:27 +01:00
parent da8aec9aed
commit 3588bb3f5e
1 changed files with 4 additions and 11 deletions

View File

@ -24,6 +24,7 @@ from tempest.common.utils import net_utils
from tempest.common import waiters
from tempest import config
from tempest.lib.common.utils.linux import remote_client
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@ -168,7 +169,9 @@ class AttachInterfacesTestJSON(AttachInterfacesTestBase):
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
@ -260,16 +263,6 @@ class AttachInterfacesTestJSON(AttachInterfacesTestBase):
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)