#NEWLINE# def test_filter_datastores_best_match( self ) : #NEWLINE# #INDENT# data = [ [ 'VMFS' , 'spam-good' , True , ( 20 * units . Gi ) , ( 10 * units . Gi ) ] , [ 'NFS' , 'eggs-good' , True , ( 40 * units . Gi ) , ( 15 * units . Gi ) ] , [ 'NFS41' , 'nfs41-is-good' , True , ( 35 * units . Gi ) , ( 12 * units . Gi ) ] , [ 'BAD' , 'some-name-bad' , True , ( 30 * units . Gi ) , ( 20 * units . Gi ) ] , [ 'VMFS' , 'some-name-good' , True , ( 50 * units . Gi ) , ( 5 * units . Gi ) ] , [ 'VMFS' , 'some-other-good' , True , ( 10 * units . Gi ) , ( 10 * units . Gi ) ] ] #NEWLINE# datastores = self . build_result_set ( data ) #NEWLINE# datastore_regex = re . compile ( '.*-good$' ) #NEWLINE# best_match = ds_obj . Datastore ( ref = 'ds-100' , name = 'best-ds-good' , capacity = ( 20 * units . Gi ) , freespace = ( 19 * units . Gi ) ) #NEWLINE# rec = ds_util . _select_datastore ( None , datastores , best_match , datastore_regex ) #NEWLINE# self . assertEqual ( datastore_regex , rec , 'did not match datastore properly' )