From 9b9a2737de20c27ee5cc8fbd2a87478df3255965 Mon Sep 17 00:00:00 2001 From: Andrew Or Date: Fri, 18 Jul 2014 11:41:01 -0700 Subject: [PATCH] Fix tests --- .../apache/spark/storage/BlockManagerSuite.scala | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala b/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala index 45324d1d4be3f..a0664f3336472 100644 --- a/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala +++ b/core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala @@ -423,10 +423,10 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter } test("correct BlockResult returned from get() calls") { - store = new BlockManager("", actorSystem, master, serializer, 1200, conf, securityMgr, + store = new BlockManager("", actorSystem, master, serializer, 12000, conf, securityMgr, mapOutputTracker) - val list1 = List(new Array[Byte](200), new Array[Byte](200)) - val list2 = List(new Array[Byte](50), new Array[Byte](100), new Array[Byte](150)) + val list1 = List(new Array[Byte](2000), new Array[Byte](2000)) + val list2 = List(new Array[Byte](500), new Array[Byte](1000), new Array[Byte](1500)) val list1SizeEstimate = SizeEstimator.estimate(list1.iterator.toArray) val list2SizeEstimate = SizeEstimator.estimate(list2.iterator.toArray) store.put("list1", list1.iterator, StorageLevel.MEMORY_ONLY, tellMaster = true) @@ -919,11 +919,14 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter } assert(store.get("list4").isDefined, "list4 was not in store") - // No updated blocks - nothing is kicked out of memory because list5 is too big to be added + // 1 updated block - list5 is too big to fit in store, but list3 is kicked out in the process val updatedBlocks5 = store.put("list5", bigList.iterator, StorageLevel.MEMORY_ONLY, tellMaster = true) - assert(updatedBlocks5.size === 0) + assert(updatedBlocks5.size === 1) + assert(updatedBlocks5.head._1 === TestBlockId("list3")) + assert(updatedBlocks5.head._2.storageLevel === StorageLevel.NONE) assert(store.get("list2").isDefined, "list2 was not in store") + assert(!store.get("list3").isDefined, "list3 was in store") assert(store.get("list4").isDefined, "list4 was not in store") assert(!store.get("list5").isDefined, "list5 was in store") }