#NEWLINE# def test_get_extended_cost_matrix_multi_inst( self ) : #NEWLINE# #INDENT# 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_different_host' : [ instance1_uuid , instance2_uuid ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# fake_cost = self . cost_classes [ 0 ] ( ) #NEWLINE# expected_x_cost_mat = [ [ 1 , 2 , 3 , 4 ] , [ 0 , 1 , 2 , 3 ] , [ 1 , 2 , 3 , 4 ] , [ 0 , 1 , 2 , 3 ] ] #NEWLINE# x_cost_mat = fake_cost . get_extended_cost_matrix ( expected_x_cost_mat , fake_filter_properties ) #NEWLINE# self . assertEqual ( expected_x_cost_mat , x_cost_mat )