Skip to content

Commit

Permalink
[SPARK-32024][WEBUI][FOLLOWUP] Quick fix on test failure on missing w…
Browse files Browse the repository at this point in the history
…hen statements

### What changes were proposed in this pull request?

This patch fixes the test failure due to the missing when statements for destination path. Note that it didn't fail on master branch, because 245aee9 got rid of size call in destination path, but still good to not depend on 245aee9.

### Why are the changes needed?

The build against branch-3.0 / branch-2.4 starts to fail after merging SPARK-32024 (#28859) and this patch will fix it.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Ran modified UT against master / branch-3.0 / branch-2.4.

Closes #29046 from HeartSaVioR/QUICKFIX-SPARK-32024.

Authored-by: Jungtaek Lim (HeartSaVioR) <kabhwan.opensource@gmail.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
(cherry picked from commit 161cf2a)
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
  • Loading branch information
HeartSaVioR authored and HyukjinKwon committed Jul 9, 2020
1 parent 30e3fcb commit f9d53a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -248,7 +248,7 @@ private class HistoryServerDiskManager(
}
}

private def appStorePath(appId: String, attemptId: Option[String]): File = {
private[history] def appStorePath(appId: String, attemptId: Option[String]): File = {
val fileName = appId + attemptId.map("_" + _).getOrElse("") + ".ldb"
new File(appStoreDir, fileName)
}
Expand Down
Expand Up @@ -162,6 +162,8 @@ class HistoryServerDiskManagerSuite extends SparkFunSuite with BeforeAndAfter {
val manager = mockManager()
val leaseA = manager.lease(2)
doReturn(3L).when(manager).sizeOf(meq(leaseA.tmpPath))
val dstPathA = manager.appStorePath("app1", None)
doReturn(3L).when(manager).sizeOf(meq(dstPathA))
val dstA = leaseA.commit("app1", None)
assert(manager.free() === 0)
assert(manager.committed() === 3)
Expand All @@ -182,6 +184,8 @@ class HistoryServerDiskManagerSuite extends SparkFunSuite with BeforeAndAfter {
val leaseB = manager1.lease(2)
assert(manager1.free() === 1)
doReturn(2L).when(manager1).sizeOf(meq(leaseB.tmpPath))
val dstPathB = manager.appStorePath("app2", None)
doReturn(2L).when(manager1).sizeOf(meq(dstPathB))
val dstB = leaseB.commit("app2", None)
assert(manager1.committed() === 2)
// Listing store tracks dstB only, dstA is evicted by "makeRoom()".
Expand All @@ -197,6 +201,8 @@ class HistoryServerDiskManagerSuite extends SparkFunSuite with BeforeAndAfter {
assert(manager2.free() === 0)
val leaseC = manager2.lease(2)
doReturn(2L).when(manager2).sizeOf(meq(leaseC.tmpPath))
val dstPathC = manager.appStorePath("app3", None)
doReturn(2L).when(manager2).sizeOf(meq(dstPathC))
val dstC = leaseC.commit("app3", None)
assert(manager2.free() === 1)
assert(manager2.committed() === 2)
Expand Down

0 comments on commit f9d53a6

Please sign in to comment.