#NEWLINE# @ mock . patch ( 'nova.scheduler.filters.utils.aggregate_values_from_key' ) #NEWLINE# def test_aggregate_filter_num_iops_value( self , agg_mock ) : #NEWLINE# #INDENT# self . flags ( max_io_ops_per_host = 7 ) #NEWLINE# self . filt_cls = io_ops_filter . AggregateIoOpsFilter ( ) #NEWLINE# host = fakes . FakeHostState ( 'host1' , 'node1' , { #NEWLINE# #INDENT# 'num_io_ops' : 7 , #NEWLINE# #UNINDENT# } ) #NEWLINE# spec_obj = objects . RequestSpec ( context = mock . sentinel . ctx ) #NEWLINE# agg_mock . return_value = set ( [ ] ) #NEWLINE# self . assertFalse ( self . filt_cls . host_passes ( host , spec_obj ) ) #NEWLINE# agg_mock . assert_called_once_with ( host , 'max_io_ops_per_host' ) #NEWLINE# agg_mock . return_value = set ( [ '8' ] ) #NEWLINE# self . assertTrue ( self . filt_cls . host_passes ( spec_obj , spec_obj ) )