@@ -117,11 +117,15 @@ def test_create_image(self, mock_execute):
117
117
@mock .patch ('os.path.exists' , return_value = True )
118
118
@mock .patch ('oslo_concurrency.processutils.execute' )
119
119
@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 ):
121
123
mock_execute .return_value = ('stdout' , None )
122
124
mock_info .return_value = mock .Mock (
123
125
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
125
129
libvirt_utils .create_cow_image (mock .sentinel .backing_path ,
126
130
mock .sentinel .new_path )
127
131
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):
131
135
mock .sentinel .backing_path , mock .sentinel .backing_fmt ,
132
136
mock .sentinel .cluster_size ),
133
137
mock .sentinel .new_path )])
138
+ mock_detect .return_value .safety_check .assert_called_once_with ()
134
139
135
140
@ddt .unpack
136
141
@ddt .data ({'fs_type' : 'some_fs_type' ,
0 commit comments