ukby1234 commented on code in PR #37960: URL: https://github.com/apache/spark/pull/37960#discussion_r978122465
########## core/src/test/scala/org/apache/spark/storage/FallbackStorageSuite.scala: ########## @@ -107,6 +106,51 @@ class FallbackStorageSuite extends SparkFunSuite with LocalSparkContext { FallbackStorage.read(conf, ShuffleBlockId(1, 2L, 0)) } + test("fallback storage APIs - readFully") { + val conf = new SparkConf(false) + .set("spark.app.id", "testId") + .set(SHUFFLE_COMPRESS, false) + .set(STORAGE_DECOMMISSION_SHUFFLE_BLOCKS_ENABLED, true) + .set(STORAGE_DECOMMISSION_FALLBACK_STORAGE_PATH, + Files.createTempDirectory("tmp").toFile.getAbsolutePath + "/") + val fallbackStorage = new FallbackStorage(conf) + val bmm = new BlockManagerMaster(new NoopRpcEndpointRef(conf), null, conf, false) + + val bm = mock(classOf[BlockManager]) + val dbm = new DiskBlockManager(conf, deleteFilesOnStop = false, isDriver = false) + when(bm.diskBlockManager).thenReturn(dbm) + when(bm.master).thenReturn(bmm) + val resolver = new IndexShuffleBlockResolver(conf, bm) + when(bm.migratableResolver).thenReturn(resolver) + + val length = 100000 + val content = new Array[Byte](length) + Random.nextBytes(content) + + val indexFile = resolver.getIndexFile(1, 2L) + tryWithResource(new FileOutputStream(indexFile)) { fos => + tryWithResource(new DataOutputStream(fos)) { dos => Review Comment: Deleted `tryWithResource` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org