Merge "Upgrade to latest hacking - v6"
diff --git a/ironic_tempest_plugin/config.py b/ironic_tempest_plugin/config.py
index 6b05402..fd86d47 100644
--- a/ironic_tempest_plugin/config.py
+++ b/ironic_tempest_plugin/config.py
@@ -97,6 +97,9 @@
                default=30,
                help="Timeout for association of Nova instance and Ironic "
                     "node"),
+    cfg.IntOpt('inspect_timeout',
+               default=10,
+               help="Timeout for inspecting an Ironic node."),
     cfg.IntOpt('power_timeout',
                default=60,
                help="Timeout for Ironic power transitions."),
diff --git a/ironic_tempest_plugin/tests/api/admin/test_nodes.py b/ironic_tempest_plugin/tests/api/admin/test_nodes.py
index 6d26a26..8e8e217 100644
--- a/ironic_tempest_plugin/tests/api/admin/test_nodes.py
+++ b/ironic_tempest_plugin/tests/api/admin/test_nodes.py
@@ -869,13 +869,6 @@
         _, self.node = self.create_node(self.chassis['uuid'])
         self.provide_node(self.node['uuid'])
 
-    def tearDown(self):
-        try:
-            self.client.update_node(self.node['uuid'], protected=False)
-        except Exception:
-            pass
-        super(TestNodeProtected, self).tearDown()
-
     @decorators.idempotent_id('52f0cb1c-ad7b-43dc-8e22-a76438b67716')
     def test_node_protected_set_unset(self):
         self.deploy_node(self.node['uuid'])
@@ -905,6 +898,7 @@
         self.assertRaises(lib_exc.Forbidden,
                           self.set_node_provision_state,
                           self.node['uuid'], 'rebuild', 'active')
+        self.client.update_node(self.node['uuid'], protected=False)
 
     @decorators.idempotent_id('04a21b51-2991-4213-8c2f-a96cfdada802')
     def test_node_protected_from_deletion(self):
@@ -918,6 +912,7 @@
         self.assertRaises(lib_exc.Forbidden,
                           self.client.delete_node,
                           self.node['uuid'])
+        self.client.update_node(self.node['uuid'], protected=False)
 
     @decorators.attr(type='negative')
     @decorators.idempotent_id('1c819f4c-6c1d-4150-ba4a-3b0dcb3c8694')
@@ -933,6 +928,7 @@
         self.assertRaises(lib_exc.BadRequest,
                           self.client.update_node,
                           self.node['uuid'], protected_reason='reason!')
+        self.client.update_node(self.node['uuid'], protected=False)
 
 
 class TestNodesProtectedOldApi(base.BaseBaremetalTest):
diff --git a/ironic_tempest_plugin/tests/api/base.py b/ironic_tempest_plugin/tests/api/base.py
index c541dd3..5469579 100644
--- a/ironic_tempest_plugin/tests/api/base.py
+++ b/ironic_tempest_plugin/tests/api/base.py
@@ -12,6 +12,7 @@
 
 import functools
 
+from oslo_log import log as logging
 from tempest import config
 from tempest.lib.common import api_version_utils
 from tempest.lib.common.utils import data_utils
@@ -22,6 +23,8 @@
 from ironic_tempest_plugin.services.baremetal import base
 from ironic_tempest_plugin.tests.api.admin import api_microversion_fixture
 
+
+LOG = logging.getLogger(__name__)
 CONF = config.CONF
 
 
@@ -124,7 +127,8 @@
                     cls.set_node_provision_state(node, 'deleted',
                                                  ['available', None])
                 except lib_exc.BadRequest:
-                    pass
+                    LOG.warning('Cleanup: Failed to unprovision node: %s',
+                                node)
 
             # Delete allocations explicitly after unprovisioning instances, but
             # before deleting nodes.
@@ -132,13 +136,15 @@
                 try:
                     cls.client.delete_allocation(allocation)
                 except lib_exc.NotFound:
-                    pass
+                    LOG.warning('Cleanup: Failed to delete allocation: %s',
+                                allocation)
 
             for node in cls.created_objects['node']:
                 try:
                     cls.client.update_node(node, instance_uuid=None)
                 except lib_exc.TempestException:
-                    pass
+                    LOG.warning('Cleanup: Failed to delete node: %s',
+                                node)
 
             for resource in RESOURCE_TYPES:
                 uuids = cls.created_objects[resource]
diff --git a/ironic_tempest_plugin/tests/scenario/baremetal_manager.py b/ironic_tempest_plugin/tests/scenario/baremetal_manager.py
index ac4d5cc..27b3c9d 100644
--- a/ironic_tempest_plugin/tests/scenario/baremetal_manager.py
+++ b/ironic_tempest_plugin/tests/scenario/baremetal_manager.py
@@ -271,7 +271,8 @@
             password=rescue_password,
             server=self.instance,
             servers_client=servers_client,
-            ssh_timeout=CONF.baremetal.rescue_timeout)
+            ssh_timeout=CONF.baremetal.rescue_timeout,
+            ssh_allow_agent=False)
         linux_client.validate_authentication()
 
     def unrescue_instance(self, instance, node, server_ip,
diff --git a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_inspection_basic.py b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_inspection_basic.py
index d6e2af1..97f0fa3 100644
--- a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_inspection_basic.py
+++ b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_inspection_basic.py
@@ -12,11 +12,14 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest import config
 from tempest.lib import decorators
 
 from ironic_tempest_plugin.tests.scenario import \
     baremetal_standalone_manager as bsm
 
+CONF = config.CONF
+
 
 class BaremetalIdracInspect(bsm.BaremetalStandaloneScenarioTest):
 
@@ -50,7 +53,8 @@
         self.baremetal_client.set_node_provision_state(self.node['uuid'],
                                                        'inspect')
 
-        self.wait_provisioning_state(self.node['uuid'], 'manageable')
+        self.wait_provisioning_state(self.node['uuid'], 'manageable',
+                                     timeout=CONF.baremetal.inspect_timeout)
 
         self._verify_node_inspection_data()
 
diff --git a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_ramdisk_iso.py b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_ramdisk_iso.py
index 815effb..9f8ff13 100644
--- a/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_ramdisk_iso.py
+++ b/ironic_tempest_plugin/tests/scenario/ironic_standalone/test_ramdisk_iso.py
@@ -22,14 +22,10 @@
 CONF = config.CONF
 
 
-class BaremetalRamdiskBootIso(bsm.BaremetalStandaloneScenarioTest):
+class BaremetalRamdiskBootIsoIPXE(bsm.BaremetalStandaloneScenarioTest):
 
-    if 'redfish' in CONF.baremetal.enabled_hardware_types:
-        driver = 'redfish'
-        boot_interface = 'redfish-virtual-media'
-    else:
-        driver = 'ipmi'
-        boot_interface = 'ipxe'
+    driver = 'ipmi'
+    boot_interface = 'ipxe'
     delete_node = False
     deploy_interface = 'ramdisk'
     api_microversion = '1.66'
@@ -38,7 +34,30 @@
 
     @classmethod
     def skip_checks(cls):
-        super(BaremetalRamdiskBootIso, cls).skip_checks()
+        super().skip_checks()
+        if not cls.image_ref:
+            raise cls.skipException('Skipping ramdisk ISO booting as'
+                                    'no ramdisk_iso_image_ref is defined.')
+
+    @decorators.idempotent_id('2859d115-9266-4461-9286-79b146e65dc9')
+    @utils.services('image', 'network')
+    def test_ramdisk_boot(self):
+        self.boot_and_verify_ramdisk_node(self.image_ref, iso=True)
+
+
+class BaremetalRamdiskBootIsoVMedia(bsm.BaremetalStandaloneScenarioTest):
+
+    driver = 'redfish'
+    boot_interface = 'redfish-virtual-media'
+    delete_node = False
+    deploy_interface = 'ramdisk'
+    api_microversion = '1.66'
+    image_ref = CONF.baremetal.ramdisk_iso_image_ref
+    wholedisk_image = False
+
+    @classmethod
+    def skip_checks(cls):
+        super().skip_checks()
         if not cls.image_ref:
             raise cls.skipException('Skipping ramdisk ISO booting as'
                                     'no ramdisk_iso_image_ref is defined.')
diff --git a/tox.ini b/tox.ini
index 7c36faf..3a67abc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,7 +1,6 @@
 [tox]
 minversion = 3.18.0
 envlist = pep8
-skipsdist = True
 ignore_basepython_conflict=true
 
 [testenv]