#NEWLINE# def test_configure_add_same_dir_multiple_times_same_priority( self ) : #NEWLINE# #INDENT# '\n        Tests BadStoreConfiguration exception is raised if same directory\n        is specified multiple times in filesystem_store_datadirs.\n        ' #NEWLINE# store_map = [ self . useFixture ( fixtures . TempDir ( ) ) . path , self . useFixture ( fixtures . TempDir ( ) ) . path ] #NEWLINE# self . conf . set_override ( 'filesystem_store_datadir' , override = None , group = 'glance_store' ) #NEWLINE# self . conf . set_override ( 'filesystem_store_datadirs' , [ ( store_map [ 0 ] + ':100' ) , ( store_map [ 1 ] + ':200' ) , ( store_map [ 0 ] + ':100' ) ] , group = 'glance_store' ) #NEWLINE# try : #NEWLINE# #INDENT# self . store . configure ( ) #NEWLINE# #UNINDENT# except exceptions . BadStoreConfiguration : #NEWLINE# #INDENT# self . fail ( 'configure() raised BadStoreConfiguration unexpectedly!' ) #NEWLINE# #UNINDENT# ChunkedFile . CHUNKSIZE = 1024 #NEWLINE# expected_image_id = str ( uuid . uuid4 ( ) ) #NEWLINE# expected_file_size = ( 5 * units . Ki ) #NEWLINE# expected_file_contents = ( b'*' * expected_file_size ) #NEWLINE# expected_checksum = hashlib . md5 ( expected_file_contents ) . hexdigest ( ) #NEWLINE# expected_location = ( 'file://%s/%s' % ( store_map [ 1 ] , expected_image_id ) ) #NEWLINE# image_file = six . BytesIO ( expected_file_contents ) #NEWLINE# ( loc , size , checksum , _ ) = self . store . add ( expected_image_id , image_file , expected_file_size ) #NEWLINE# self . assertEqual ( expected_location , loc ) #NEWLINE# self . assertEqual ( expected_file_size , size ) #NEWLINE# self . assertEqual ( expected_checksum , checksum ) #NEWLINE# loc = location . get_location_from_uri ( expected_location , conf = self . conf ) #NEWLINE# ( new_image_file , new_image_size ) = self . store . get ( loc ) #NEWLINE# new_image_contents = b'' #NEWLINE# new_image_file_size = 0 #NEWLINE# for chunk in new_image_file : #NEWLINE# #INDENT# new_image_file_size += len ( chunk ) #NEWLINE# new_image_contents += chunk #NEWLINE# #UNINDENT# self . assertEqual ( expected_file_contents , new_image_contents ) #NEWLINE# self . assertEqual ( expected_file_size , new_image_file_size )