Merge "Tests: Fix missing RBD delete_volume test case"

This commit is contained in:
Zuul 2021-11-19 20:04:32 +00:00 committed by Gerrit Code Review
commit d6423e78b2

View File

@ -836,10 +836,13 @@ class RBDTestCase(test.TestCase):
2, drv.rbd.RBD.return_value.trash_move.call_count)
@common_mocks
def delete_volume_not_found(self):
def test_delete_volume_not_found_at_open(self):
self.mock_rbd.Image.side_effect = self.mock_rbd.ImageNotFound
self.assertIsNone(self.driver.delete_volume(self.volume_a))
self.mock_rbd.Image.assert_called_once_with()
with mock.patch.object(driver, 'RADOSClient') as client:
client = self.mock_client.return_value.__enter__.return_value
self.mock_rbd.Image.assert_called_once_with(client.ioctx,
self.volume_a.name)
# Make sure the exception was raised
self.assertEqual([self.mock_rbd.ImageNotFound], RAISED_EXCEPTIONS)