Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix UT
  • Loading branch information
sharkdtu committed Jul 10, 2018
commit 380f242cea5ef1d43c0ec42f57598cf21b24c3e2
Original file line number Diff line number Diff line change
Expand Up @@ -1427,17 +1427,12 @@ class BlockManagerSuite extends SparkFunSuite with Matchers with BeforeAndAfterE
val blockLocations = Seq(BlockManagerId("1", "host1", 100), BlockManagerId("2", "host2", 200))
when(mockBlockManagerMaster.getLocations(mc.any[Array[BlockId]]))
.thenReturn(Array(blockLocations))

val bm = mock(classOf[BlockManager])
when(bm.master).thenReturn(mockBlockManagerMaster)

val env = mock(classOf[SparkEnv])
when(env.blockManager).thenReturn(bm)

val blockId = StreamBlockId(1, 2)
val locs = BlockManager.blockIdsToLocations(Array(blockId), env)
val blockIds: Array[BlockId] = Array(StreamBlockId(1, 2))
val locs = BlockManager.blockIdsToLocations(blockIds, env, mockBlockManagerMaster)
val expectedLocs = Seq("executor_host1_1", "executor_host2_2")
assert(locs(blockId) == expectedLocs)
assert(locs(blockIds(0)) == expectedLocs)
}

class MockBlockTransferService(val maxFailures: Int) extends BlockTransferService {
Expand Down