@@ -156,7 +156,9 @@ def test_configure(self):
156156 def test_update (self ):
157157 self ._test_no_resource_id (domain_tasks .update ,
158158 "No servers for update" )
159- self ._test_check_correct_connect_action (domain_tasks .update )
159+ self ._test_check_correct_connect_action (
160+ "cloudify_libvirt.domain_tasks.libvirt.open" ,
161+ domain_tasks .update )
160162 self ._test_check_correct_connect_no_object (domain_tasks .update )
161163 # check memory
162164 self ._test_action_states (
@@ -180,7 +182,9 @@ def test_update(self):
180182 def test_reboot (self ):
181183 self ._test_no_resource_id (domain_tasks .reboot ,
182184 "No servers for reboot" )
183- self ._test_check_correct_connect_action (domain_tasks .reboot )
185+ self ._test_check_correct_connect_action (
186+ "cloudify_libvirt.domain_tasks.libvirt.open" ,
187+ domain_tasks .reboot )
184188 self ._test_check_correct_connect_no_object (domain_tasks .reboot )
185189 self ._test_action_states (
186190 domain_tasks .reboot ,
@@ -190,7 +194,9 @@ def test_reboot(self):
190194 def test_start (self ):
191195 self ._test_no_resource_id (domain_tasks .start ,
192196 "No servers for start" )
193- self ._test_check_correct_connect_action (domain_tasks .start )
197+ self ._test_check_correct_connect_action (
198+ "cloudify_libvirt.domain_tasks.libvirt.open" ,
199+ domain_tasks .start )
194200 self ._test_check_correct_connect_no_object (domain_tasks .start )
195201 self ._test_action_states (
196202 domain_tasks .start ,
@@ -202,7 +208,9 @@ def test_stop(self):
202208 self ._test_reused_object (
203209 "cloudify_libvirt.domain_tasks.libvirt.open" ,
204210 domain_tasks .stop )
205- self ._test_check_correct_connect_action (domain_tasks .stop )
211+ self ._test_check_correct_connect_action (
212+ "cloudify_libvirt.domain_tasks.libvirt.open" ,
213+ domain_tasks .stop )
206214 self ._test_check_correct_connect_no_object (domain_tasks .stop )
207215 self ._test_action_states (
208216 domain_tasks .stop ,
@@ -212,7 +220,9 @@ def test_stop(self):
212220 def test_resume (self ):
213221 self ._test_no_resource_id (domain_tasks .resume ,
214222 "No servers for resume" )
215- self ._test_check_correct_connect_action (domain_tasks .resume )
223+ self ._test_check_correct_connect_action (
224+ "cloudify_libvirt.domain_tasks.libvirt.open" ,
225+ domain_tasks .resume )
216226 self ._test_check_correct_connect_no_object (domain_tasks .resume )
217227 self ._test_action_states (
218228 domain_tasks .resume ,
@@ -222,7 +232,9 @@ def test_resume(self):
222232 def test_suspend (self ):
223233 self ._test_no_resource_id (domain_tasks .suspend ,
224234 "No servers for suspend" )
225- self ._test_check_correct_connect_action (domain_tasks .suspend )
235+ self ._test_check_correct_connect_action (
236+ "cloudify_libvirt.domain_tasks.libvirt.open" ,
237+ domain_tasks .suspend )
226238 self ._test_check_correct_connect_no_object (domain_tasks .suspend )
227239 self ._test_action_states (
228240 domain_tasks .suspend ,
@@ -234,7 +246,9 @@ def test_delete(self):
234246 self ._test_reused_object (
235247 "cloudify_libvirt.domain_tasks.libvirt.open" ,
236248 domain_tasks .delete )
237- self ._test_check_correct_connect_action (domain_tasks .delete )
249+ self ._test_check_correct_connect_action (
250+ "cloudify_libvirt.domain_tasks.libvirt.open" ,
251+ domain_tasks .delete )
238252 self ._test_check_correct_connect_no_object (domain_tasks .delete )
239253
240254 # delete snapshot with error
@@ -262,7 +276,7 @@ def test_delete(self):
262276 ):
263277 with self .assertRaisesRegexp (
264278 RecoverableError ,
265- "Still have several snapshots: \['snapshot!'\]."
279+ "Still have several snapshots: \\ ['snapshot!'\ \ ]."
266280 ):
267281 domain_tasks .delete (ctx = _ctx ,
268282 snapshot_name = 'snapshot_name' ,
@@ -326,7 +340,9 @@ def _snapshot_list():
326340 def test_perfomance (self ):
327341 self ._test_no_resource_id (domain_tasks .perfomance ,
328342 "No servers for statistics." )
329- self ._test_check_correct_connect_action (domain_tasks .perfomance )
343+ self ._test_check_correct_connect_action (
344+ "cloudify_libvirt.domain_tasks.libvirt.open" ,
345+ domain_tasks .perfomance )
330346 self ._test_check_correct_connect_no_object (domain_tasks .perfomance )
331347
332348 # some fake statistics
@@ -532,14 +548,6 @@ def _test_check_correct_connect_no_object(self, func):
532548 "cloudify_libvirt.domain_tasks.libvirt.open" , func , [],
533549 {'ctx' : _ctx }, 'resource' )
534550
535- def _test_check_correct_connect_action (self , func ):
536- # check correct handle exception with empty connection
537- _ctx = self ._create_ctx ()
538- _ctx .instance .runtime_properties ['resource_id' ] = 'resource'
539- self ._check_correct_connect (
540- "cloudify_libvirt.domain_tasks.libvirt.open" ,
541- func , [], {'ctx' : _ctx })
542-
543551 def _check_create_backups (self , _ctx , connect , domain , snapshot , raw_case ):
544552 # raw_case - dump xml without real raw dump
545553 _ctx .instance .runtime_properties ['params' ]['full_dump' ] = raw_case
@@ -555,7 +563,7 @@ def _check_create_backups(self, _ctx, connect, domain, snapshot, raw_case):
555563 ):
556564 with self .assertRaisesRegexp (
557565 NonRecoverableError ,
558- "Snapshot snapshot\! already exists."
566+ "Snapshot snapshot\\ ! already exists."
559567 ):
560568 domain_tasks .snapshot_create (
561569 ctx = _ctx ,
@@ -847,7 +855,7 @@ def test_snapshot_delete(self):
847855 ):
848856 with self .assertRaisesRegexp (
849857 NonRecoverableError ,
850- "Sub snapshots \['snapshot-'\] found for "
858+ "Sub snapshots \\ ['snapshot-'\ \ ] found for "
851859 "node_name-snapshot_name. You should remove subsnaphots before"
852860 " remove current."
853861 ):
0 commit comments