#NEWLINE# def test_get_extended_cost_matrix_change_multiplier( self ) : #NEWLINE# #INDENT# self . flags ( affinity_cost_multiplier = 0.5 , group = 'solver_scheduler' ) #NEWLINE# fake_hosts = self . _get_fake_hosts ( ) #NEWLINE# instance1 = objects . Instance ( uuid = 'inst1' ) #NEWLINE# instance2 = objects . Instance ( uuid = 'inst2' ) #NEWLINE# instance1_uuid = instance1 . uuid #NEWLINE# instance2_uuid = instance2 . uuid #NEWLINE# fake_hosts [ 0 ] . instances = { #NEWLINE# #INDENT# instance1_uuid : instance1 , #NEWLINE# #UNINDENT# } #NEWLINE# fake_hosts [ 2 ] . instances = { #NEWLINE# #INDENT# instance2_uuid : instance2 , #NEWLINE# #UNINDENT# } #NEWLINE# fake_filter_properties = { #NEWLINE# #INDENT# 'context' : self . context . elevated ( ) , #NEWLINE# 'num_instances' : 3 , #NEWLINE# 'instance_uuids' : [ ( 'fake_uuid_%s' % x ) for x in range ( 3 ) ] , #NEWLINE# 'scheduler_hints' : { #NEWLINE# #INDENT# 'soft_same_host' : [ instance1_uuid , instance2_uuid ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# fake_cost = self . cost_classes [ 0 ] ( ) #NEWLINE# expected_x_cost_mat = [ [ 0 , ( - 2 ) , ( - 4 ) , ( - 6 ) ] , [ 1 , ( - 1 ) , ( - 3 ) , ( - 5 ) ] , [ 0 , ( - 2 ) , ( - 4 ) , ( - 6 ) ] , [ 1 , ( - 1 ) , ( - 3 ) , ( - 5 ) ] ] #NEWLINE# x_cost_mat = fake_cost . get_extended_cost_matrix ( instance1_uuid , fake_filter_properties ) #NEWLINE# self . assertEqual ( expected_x_cost_mat , x_cost_mat )