Tests: Fix missing RBD delete_volume test case

This test intends to test the first rbd.Image() call
returning ImageNotFound in the RBD driver's delete_volume
method, but was not previously running.

Change-Id: Id0d6bc6ec08f0513d5fe8c2ee38a8f49830e6744
This commit is contained in:
Eric Harney 2021-09-08 14:30:30 -04:00
parent d81a838639
commit 7fd59da145

View File

@ -793,10 +793,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)