Tests: Improve RBD v2 clone API unit tests
Lots of things can call log.info or log.warning,
ensure the tests around logging are looking for
specific calls.
@@ -896,7 +896,8 @@ class RBDTestCase(test.TestCase):
self.driver.create_volume_from_snapshot(self.volume_a, snapshot)
- mock_log.info.assert_called_once_with(mock.ANY)
+ mock_log.info.assert_called_with('Using v2 Clone API')
+
self.assertTrue(self.driver._clone_v2_api_checked)
@common_mocks
@@ -917,7 +918,9 @@ class RBDTestCase(test.TestCase):
self.driver.create_volume_from_snapshot(self.volume_a, snapshot)
- mock_log.warning.assert_called_once_with(mock.ANY)
+ self.assertTrue(any(m for m in mock_log.warning.call_args_list
+ if 'Not using v2 clone API' in m[0][0]))
+
self.assertTrue(self.driver._clone_v2_api_checked)
@common_mocks
