Fix failure cases around test_ports
In some cases where operators seek to use ironic-tempest-plugin,
there may not be complete networking configuration behind ironic,
like site specific cleaning and provisioning networks, which is
fine, that is a choice the operator has made, but then if the
default network interface, which these tests were modeled upon
is a different network interface, such as flat or neutron,
then these tests will fail.
So instead of rely upon the state configuration of ironic
in terms of what network interface to end up with, we now assert
the noop network interface to explicitly tell ironic "we know what
we want/expect" for the test to operate.
This sort of class of failure has come up a few times with slight
variations, where functionally the test suite just was developed
expecting everything under the backend driver hood to be noop.
Closes-Bug: 2087263
Change-Id: Iea732f58c23dd0c79305a86b6707fb750aabf30f
diff --git a/ironic_tempest_plugin/tests/api/admin/test_ports.py b/ironic_tempest_plugin/tests/api/admin/test_ports.py
index dfb371c..9bf2771 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_ports.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_ports.py
@@ -25,9 +25,23 @@
super(TestPorts, self).setUp()
_, self.chassis = self.create_chassis()
+ # NOTE(TheJulia): noop is required for the network interface for
+ # these tests, as newer versions of ironic can invoke network
+ # logic, and if is not configured with full integration configuration,
+ # can then result in failed tests.
_, self.node = self.create_node(self.chassis['uuid'])
_, self.port = self.create_port(self.node['uuid'],
data_utils.rand_mac_address())
+ self.useFixture(
+ api_microversion_fixture.APIMicroversionFixture('1.31'))
+ # Now with a 1.31 microversion, swap the network interfaces
+ # into place so the test doesn't break depending on
+ # the environment's default state.
+ self.client.update_node(self.node['uuid'],
+ [{'path': '/network_interface',
+ 'op': 'replace',
+ 'value': 'noop'}])
+ self.useFixture(api_microversion_fixture.APIMicroversionFixture('1.1'))
@decorators.idempotent_id('83975898-2e50-42ed-b5f0-e510e36a0b56')
def test_create_port(self):
diff --git a/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py b/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py
index bd338f9..98a4747 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_ports_negative.py
@@ -26,6 +26,16 @@
_, self.chassis = self.create_chassis()
_, self.node = self.create_node(self.chassis['uuid'])
+ self.useFixture(
+ api_microversion_fixture.APIMicroversionFixture('1.31'))
+ # Now with a 1.31 microversion, swap the network interfaces
+ # into place so the test doesn't break depending on
+ # the environment's default state.
+ self.client.update_node(self.node['uuid'],
+ [{'path': '/network_interface',
+ 'op': 'replace',
+ 'value': 'noop'}])
+ self.useFixture(api_microversion_fixture.APIMicroversionFixture('1.1'))
@decorators.attr(type=['negative'])
@decorators.idempotent_id('0a6ee1f7-d0d9-4069-8778-37f3aa07303a')