@@ -497,7 +497,7 @@ class BlockManagerSuite extends SparkFunSuite with Matchers with BeforeAndAfterE
497497 }
498498
499499 test(" optimize a location order of blocks without topology information" ) {
500- val localHost = Utils .localHostName()
500+ val localHost = " localhost "
501501 val otherHost = " otherHost"
502502 val bmMaster = mock(classOf [BlockManagerMaster ])
503503 val bmId1 = BlockManagerId (" id1" , localHost, 1 )
@@ -512,7 +512,7 @@ class BlockManagerSuite extends SparkFunSuite with Matchers with BeforeAndAfterE
512512 }
513513
514514 test(" optimize a location order of blocks with topology information" ) {
515- val localHost = Utils .localHostName()
515+ val localHost = " localhost "
516516 val otherHost = " otherHost"
517517 val localRack = " localRack"
518518 val otherRack = " otherRack"
@@ -527,6 +527,8 @@ class BlockManagerSuite extends SparkFunSuite with Matchers with BeforeAndAfterE
527527 .thenReturn(Seq (bmId1, bmId2, bmId5, bmId3, bmId4))
528528
529529 val blockManager = makeBlockManager(128 , " exec" , bmMaster)
530+ blockManager.blockManagerId =
531+ BlockManagerId (SparkContext .DRIVER_IDENTIFIER , localHost, 1 , Some (localRack))
530532 val getLocations = PrivateMethod [Seq [BlockManagerId ]](' getLocations )
531533 val locations = blockManager invokePrivate getLocations(BroadcastBlockId (0 ))
532534 assert(locations.map(_.host) === Seq (localHost, localHost, otherHost, otherHost, otherHost))
0 commit comments