Merge "Add 'inspect wait' as a valid state"

This commit is contained in:
Zuul 2018-04-23 19:10:00 +00:00 committed by Gerrit Code Review
commit e61ed68f73
2 changed files with 13 additions and 2 deletions

View File

@ -26,8 +26,9 @@ from ironic_inspector import utils
CONF = cfg.CONF
LOG = utils.getProcessingLogger(__name__)
# See http://specs.openstack.org/openstack/ironic-specs/specs/kilo/new-ironic-state-machine.html # noqa
VALID_STATES = {'enroll', 'manageable', 'inspecting', 'inspect failed'}
# See https://docs.openstack.org/ironic/latest/contributor/states.html # noqa
VALID_STATES = {'enroll', 'manageable', 'inspecting', 'inspect wait',
'inspect failed'}
# 1.19 is API version, which supports port.pxe_enabled
DEFAULT_IRONIC_API_VERSION = '1.19'

View File

@ -263,6 +263,16 @@ class TestIntrospect(BaseTest):
self.assertFalse(start_mock.called)
self.assertFalse(self.node_info.acquire_lock.called)
def test_inspect_wait_state_allowed(self, client_mock, start_mock):
self.node.provision_state = 'inspect wait'
cli = client_mock.return_value
cli.node.get.return_value = self.node
cli.node.validate.return_value = mock.Mock(power={'result': True})
introspect.introspect(self.uuid)
self.assertTrue(start_mock.called)
@mock.patch.object(time, 'time')
def test_introspection_delay(self, time_mock, client_mock, start_mock):
time_mock.return_value = 42