#NEWLINE# def test_db_migration( self ) : #NEWLINE# #INDENT# policies = itertools . cycle ( POLICIES ) #NEWLINE# num_containers = ( len ( POLICIES ) * 3 ) #NEWLINE# per_policy_container_counts = defaultdict ( int ) #NEWLINE# for i in range ( num_containers ) : #NEWLINE# #INDENT# name = ( 'test-container-%02d' % i ) #NEWLINE# policy = next ( policies ) #NEWLINE# self . broker . put_container ( name , next ( self . ts ) , 0 , 0 , 0 , int ( policy ) ) #NEWLINE# per_policy_container_counts [ int ( policy ) ] += 1 #NEWLINE# #UNINDENT# self . broker . _commit_puts ( ) #NEWLINE# self . assertEqual ( num_containers , self . broker . get_info ( ) [ 'container_count' ] ) #NEWLINE# self . assertUnmigrated ( self . broker ) #NEWLINE# conf = { #NEWLINE# #INDENT# 'devices' : self . tempdir , #NEWLINE# 'mount_check' : False , #NEWLINE# 'recon_cache_path' : self . tempdir , #NEWLINE# #UNINDENT# } #NEWLINE# test_auditor = auditor . AccountAuditor ( conf , logger = debug_logger ( ) ) #NEWLINE# test_auditor . run_once ( ) #NEWLINE# self . restore_account_broker ( ) #NEWLINE# broker = auditor . AccountBroker ( self . db_path ) #NEWLINE# with broker . get ( ) as conn : #NEWLINE# #INDENT# rows = conn . execute ( '\n                SELECT storage_policy_index, container_count\n                FROM policy_stat\n            ' ) . fetchall ( ) #NEWLINE# #UNINDENT# for ( policy_index , container_count ) in rows : #NEWLINE# #INDENT# self . assertEqual ( container_count , per_policy_container_counts [ policy_index ] )