diff options
| author | Zuul <zuul@review.opendev.org> | 2019-09-24 12:00:00 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2019-09-24 12:00:00 +0000 |
| commit | 74c8cd581bee2da059845bb95de5160774b5f191 (patch) | |
| tree | b4e171b689e489ab3782f47cc9fb6c6f54e9a60d /ironic_python_agent/tests/unit | |
| parent | 3968ec9d5ad48f8ed13fc66ef31bef4b79a8c690 (diff) | |
| parent | 8be4cb689cac5755f09eaa27cdde86a30b2633f8 (diff) | |
| download | ironic-python-agent-74c8cd581bee2da059845bb95de5160774b5f191.tar.gz | |
Merge "Attempt tgtd session detach"5.0.0
Diffstat (limited to 'ironic_python_agent/tests/unit')
| -rw-r--r-- | ironic_python_agent/tests/unit/extensions/test_iscsi.py | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/ironic_python_agent/tests/unit/extensions/test_iscsi.py b/ironic_python_agent/tests/unit/extensions/test_iscsi.py index 3dc50905..f275c0fc 100644 --- a/ironic_python_agent/tests/unit/extensions/test_iscsi.py +++ b/ironic_python_agent/tests/unit/extensions/test_iscsi.py @@ -281,6 +281,30 @@ class TestISCSIExtensionLIO(base.IronicAgentTest): mock_destroy.assert_called_once_with('/dev/fake', 'my_node_uuid') +@mock.patch.object(utils, 'execute', autospec=True) +class TestISCSIExtensionCleanUpFallback(base.IronicAgentTest): + + def setUp(self): + super(TestISCSIExtensionCleanUpFallback, self).setUp() + self.agent_extension = iscsi.ISCSIExtension() + self.fake_dev = '/dev/fake' + self.fake_iqn = 'iqn-fake' + self.rtsmock = mock.patch.object( + iscsi.rtslib_fb, 'RTSRoot', + side_effect=EnvironmentError(), autospec=True) + + def test_lio_not_available(self, mock_execute): + mock_execute.return_value = ('', '') + expected = [mock.call('tgtadm', '--lld', 'iscsi', '--mode', + 'target', '--op', 'unbind', '--tid', '1', + '--initiator-address', 'ALL'), + mock.call('sync'), + mock.call('tgtadm', '--lld', 'iscsi', '--mode', 'target', + '--op', 'delete', '--tid', '1')] + iscsi.clean_up(self.fake_dev) + mock_execute.assert_has_calls(expected) + + @mock.patch.object(iscsi.rtslib_fb, 'RTSRoot', autospec=True) class TestISCSIExtensionCleanUp(base.IronicAgentTest): @@ -290,10 +314,6 @@ class TestISCSIExtensionCleanUp(base.IronicAgentTest): self.fake_dev = '/dev/fake' self.fake_iqn = 'iqn-fake' - def test_lio_not_available(self, mock_rtslib): - mock_rtslib.side_effect = IOError() - iscsi.clean_up(self.fake_dev) - def test_device_not_found(self, mock_rtslib): mock_rtslib.return_value.storage_objects = [] iscsi.clean_up(self.fake_dev) |
