@@ -117,11 +117,15 @@ def test_create_image(self, mock_execute):
117117 @mock .patch ('os.path.exists' , return_value = True )
118118 @mock .patch ('oslo_concurrency.processutils.execute' )
119119 @mock .patch ('nova.virt.images.qemu_img_info' )
120- def test_create_cow_image (self , mock_info , mock_execute , mock_exists ):
120+ @mock .patch ('nova.image.format_inspector.detect_file_format' )
121+ def test_create_cow_image (self , mock_detect , mock_info , mock_execute ,
122+ mock_exists ):
121123 mock_execute .return_value = ('stdout' , None )
122124 mock_info .return_value = mock .Mock (
123125 file_format = mock .sentinel .backing_fmt ,
124- cluster_size = mock .sentinel .cluster_size )
126+ cluster_size = mock .sentinel .cluster_size ,
127+ backing_file = None )
128+ mock_detect .return_value .safety_check .return_value = True
125129 libvirt_utils .create_cow_image (mock .sentinel .backing_path ,
126130 mock .sentinel .new_path )
127131 mock_info .assert_called_once_with (mock .sentinel .backing_path )
@@ -131,6 +135,7 @@ def test_create_cow_image(self, mock_info, mock_execute, mock_exists):
131135 mock .sentinel .backing_path , mock .sentinel .backing_fmt ,
132136 mock .sentinel .cluster_size ),
133137 mock .sentinel .new_path )])
138+ mock_detect .return_value .safety_check .assert_called_once_with ()
134139
135140 @ddt .unpack
136141 @ddt .data ({'fs_type' : 'some_fs_type' ,
0 commit comments