#NEWLINE# def test_solr_to_solr_reindex_and_resume( self ) : #NEWLINE# #INDENT# '\n        Only reindexes half of the collection on the first time. Then goes back and does a resume to make sure it works. \n        ' #NEWLINE# self . _index_docs ( 50000 , self . colls [ 0 ] ) #NEWLINE# solr = SolrClient ( test_config [ 'SOLR_SERVER' ] [ 0 ] , auth = test_config [ 'SOLR_CREDENTIALS' ] ) #NEWLINE# reindexer = Reindexer ( source = solr , source_coll = 'source_coll' , dest = solr , dest_coll = 'dest_coll' , date_field = 'date' ) #NEWLINE# self . assertEqual ( len ( solr . query ( self . colls [ 0 ] , { #NEWLINE# #INDENT# 'q' : '*:*' , #NEWLINE# 'rows' : 10000000 , #NEWLINE# #UNINDENT# } ) . docs ) , 50000 ) #NEWLINE# self . assertEqual ( len ( solr . query ( self . colls [ 1 ] , { #NEWLINE# #INDENT# 'q' : '*:*' , #NEWLINE# 'rows' : 10000000 , #NEWLINE# #UNINDENT# } ) . docs ) , 0 ) #NEWLINE# midpoint = ( datetime . datetime . now ( ) - datetime . timedelta ( days = ( ( self . _end_date - self . _start_date ) . days / 2 ) ) ) #NEWLINE# reindexer . reindex ( fq = [ 'date:[* TO {}]' . format ( ( midpoint . isoformat ( ) + 'Z' ) ) ] ) #NEWLINE# sleep ( 10 ) #NEWLINE# dest_count = len ( solr . query ( self . colls [ 1 ] , { #NEWLINE# #INDENT# 'q' : '*:*' , #NEWLINE# 'rows' : 10000000 , #NEWLINE# #UNINDENT# } ) . docs ) #NEWLINE# s_count = len ( solr . query ( self . colls [ 0 ] , { #NEWLINE# #INDENT# 'q' : '*:*' , #NEWLINE# 'rows' : 10000000 , #NEWLINE# #UNINDENT# } ) . docs ) #NEWLINE# self . assertTrue ( ( s_count > dest_count > ( s_count * 0.2 ) ) ) #NEWLINE# reindexer . resume ( ) #NEWLINE# sleep ( 10 ) #NEWLINE# self . assertEqual ( len ( solr . query ( self . colls [ 0 ] , { #NEWLINE# #INDENT# 'q' : '*:*' , #NEWLINE# 'rows' : 10000000 , #NEWLINE# #UNINDENT# } ) . docs ) , len ( solr . query ( self . colls [ 1 ] , { #NEWLINE# #INDENT# 'q' : '*:*' , #NEWLINE# 'rows' : 10000000 , #NEWLINE# #UNINDENT# } ) . docs ) )