@@ -107,6 +107,10 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
107107 }
108108
109109 System .clearProperty(" spark.test.useCompressedOops" )
110+
111+ // This is normally cleared when a task ends, but since we do not
112+ // mock the entire job here, we have to manually clear this ourselves
113+ SparkEnv .get.unrollMemoryMap.clear()
110114 }
111115
112116 test(" StorageLevel object caching" ) {
@@ -905,7 +909,7 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
905909 case _ => fail(" Updated block is neither list1 nor list3" )
906910 }
907911 }
908- assert(store.get (" list3" ).isDefined , " list3 was not in store" )
912+ assert(store.memoryStore.contains (" list3" ), " list3 was not in memory store" )
909913
910914 // 2 updated blocks - list2 is kicked out of memory (but put on disk) while list4 is added
911915 val updatedBlocks4 =
@@ -918,19 +922,27 @@ class BlockManagerSuite extends FunSuite with Matchers with BeforeAndAfter
918922 case _ => fail(" Updated block is neither list2 nor list4" )
919923 }
920924 }
921- assert(store.get(" list4" ).isDefined, " list4 was not in store" )
925+ assert(store.diskStore.contains(" list2" ), " list2 was not in disk store" )
926+ assert(store.memoryStore.contains(" list4" ), " list4 was not in memory store" )
922927
923- // 1 updated block - list5 is too big to fit in store, but list3 is kicked out in the process
928+ // 0 updated blocks - list5 is too big to fit in store
924929 val updatedBlocks5 =
925930 store.putIterator(" list5" , bigList.iterator, StorageLevel .MEMORY_ONLY , tellMaster = true )
926- assert(updatedBlocks5.size === 1 )
927- assert(updatedBlocks5.head._1 === TestBlockId (" list3" ))
928- assert(updatedBlocks5.head._2.storageLevel === StorageLevel .NONE )
929- assert(! store.get(" list1" ).isDefined, " list1 was in store" )
930- assert(store.get(" list2" ).isDefined, " list2 was not in store" )
931- assert(! store.get(" list3" ).isDefined, " list3 was in store" )
932- assert(store.get(" list4" ).isDefined, " list4 was not in store" )
933- assert(! store.get(" list5" ).isDefined, " list5 was in store" )
931+ assert(updatedBlocks5.size === 0 )
932+
933+ // memory store contains only list3 and list4
934+ assert(! store.memoryStore.contains(" list1" ), " list1 was in memory store" )
935+ assert(! store.memoryStore.contains(" list2" ), " list2 was in memory store" )
936+ assert(store.memoryStore.contains(" list3" ), " list3 was not in memory store" )
937+ assert(store.memoryStore.contains(" list4" ), " list4 was not in memory store" )
938+ assert(! store.memoryStore.contains(" list5" ), " list5 was in memory store" )
939+
940+ // disk store contains only list2
941+ assert(! store.diskStore.contains(" list1" ), " list1 was in disk store" )
942+ assert(store.diskStore.contains(" list2" ), " list2 was not in disk store" )
943+ assert(! store.diskStore.contains(" list3" ), " list3 was in disk store" )
944+ assert(! store.diskStore.contains(" list4" ), " list4 was in disk store" )
945+ assert(! store.diskStore.contains(" list5" ), " list5 was in disk store" )
934946 }
935947
936948 test(" query block statuses" ) {
0 commit comments