#NEWLINE# def test_delete_partition_with_failures( self ) : #NEWLINE# #INDENT# with mock . patch ( 'swift.obj.replicator.http_connect' , mock_http_connect ( 200 ) ) : #NEWLINE# #INDENT# df = self . df_mgr . get_diskfile ( 'sda' , '1' , 'a' , 'c' , 'o' , policy = POLICIES . legacy ) #NEWLINE# mkdirs ( df . _datadir ) #NEWLINE# f = open ( os . path . join ( df . _datadir , ( normalize_timestamp ( time . time ( ) ) + '.data' ) ) , 'wb' ) #NEWLINE# f . write ( '1234567890' ) #NEWLINE# f . close ( ) #NEWLINE# ohash = hash_path ( 'a' , 'c' , 'o' ) #NEWLINE# data_dir = ohash [ ( - 3 ) : ] #NEWLINE# whole_path_from = os . path . join ( self . objects , '1' , data_dir ) #NEWLINE# part_path = os . path . join ( self . objects , '1' ) #NEWLINE# self . assertTrue ( os . access ( part_path , os . F_OK ) ) #NEWLINE# ring = self . replicator . load_object_ring ( POLICIES [ 0 ] ) #NEWLINE# nodes = [ node for node in ring . get_part_nodes ( 1 ) if ( node [ 'ip' ] not in _ips ( ) ) ] #NEWLINE# process_arg_checker = [ ] #NEWLINE# for ( i , node ) in enumerate ( nodes ) : #NEWLINE# #INDENT# rsync_mod = ( '%s::object/sda/objects/%s' % ( node [ 'ip' ] , 1 ) ) #NEWLINE# if ( i == 0 ) : #NEWLINE# #INDENT# ret_code = 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ret_code = 0 #NEWLINE# #UNINDENT# process_arg_checker . append ( ( ret_code , '' , [ 'rsync' , whole_path_from , rsync_mod ] ) ) #NEWLINE# #UNINDENT# with _mock_process ( process_arg_checker ) : #NEWLINE# #INDENT# self . replicator . replicate ( ) #NEWLINE# #UNINDENT# self . assertTrue ( os . access ( part_path , os . F_OK ) )