WIP: fix vif tests

Depends-On: https://review.opendev.org/c/openstack/ironic/+/916128
Change-Id: I285c813c09eece538e66b43107825684f4681d5f
This commit is contained in:
Julia Kreger 2024-04-18 06:32:09 -07:00
parent 0eb9ae7445
commit 57b572b70b
2 changed files with 8 additions and 16 deletions

View File

@ -261,7 +261,8 @@ class BaremetalClient(base.BaremetalClient):
"""
node = {}
for field in ('resource_class', 'name', 'description', 'shard'):
for field in ('resource_class', 'name', 'description', 'shard',
'network_interface'):
if kwargs.get(field):
node[field] = kwargs[field]

View File

@ -312,7 +312,10 @@ class TestNodesVif(base.BaseBaremetalTest):
super(TestNodesVif, self).setUp()
_, self.chassis = self.create_chassis()
_, self.node = self.create_node(self.chassis['uuid'])
# The tests will mostly fail in this class if exposed to the
# noop network interface, which is what the default is.
_, self.node = self.create_node(self.chassis['uuid'],
network_interface='flat')
if CONF.network.shared_physical_network:
self.net = self.os_admin.networks_client.list_networks(
name=CONF.compute.fixed_network_name)['networks'][0]
@ -432,7 +435,9 @@ class TestNodesVif(base.BaseBaremetalTest):
data_utils.rand_mac_address())
self.client.vif_attach(self.node['uuid'], self.nport_id)
_, body = self.client.vif_list(self.node['uuid'])
self.assertEqual({'vifs': [{'id': self.nport_id}]}, body)
self.assertRaises(lib_exc.Conflict, self.client.vif_attach,
self.node['uuid'], self.nport_id)
self.client.vif_detach(self.node['uuid'], self.nport_id)
@ -555,20 +560,6 @@ class TestNodesVif(base.BaseBaremetalTest):
data_utils.rand_uuid(),
self.nport_id)
@decorators.attr(type='negative')
@decorators.idempotent_id('9290e1f9-7e75-4e12-aea7-3649348e7f36')
def test_vif_attach_no_args(self):
"""Negative test for VIF attachment with lack of arguments."""
self.assertRaises(lib_exc.BadRequest,
self.client.vif_attach,
self.node['uuid'], '')
self.assertRaises(lib_exc.BadRequest,
self.client.vif_attach,
'', '')
self.assertRaises(lib_exc.BadRequest,
self.client.vif_attach,
'', self.nport_id)
@decorators.attr(type='negative')
@decorators.idempotent_id('da036225-47b0-43b7-9586-0d6390bd3cd9')
def test_vif_detach_not_existing(self):