aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/scala/org/apache/spark/deploy/StandaloneDynamicAllocationSuite.scala
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/scala/org/apache/spark/deploy/StandaloneDynamicAllocationSuite.scala')
-rw-r--r--core/src/test/scala/org/apache/spark/deploy/StandaloneDynamicAllocationSuite.scala29
1 files changed, 17 insertions, 12 deletions
diff --git a/core/src/test/scala/org/apache/spark/deploy/StandaloneDynamicAllocationSuite.scala b/core/src/test/scala/org/apache/spark/deploy/StandaloneDynamicAllocationSuite.scala
index 2fa795f846..314517d296 100644
--- a/core/src/test/scala/org/apache/spark/deploy/StandaloneDynamicAllocationSuite.scala
+++ b/core/src/test/scala/org/apache/spark/deploy/StandaloneDynamicAllocationSuite.scala
@@ -365,7 +365,7 @@ class StandaloneDynamicAllocationSuite
val executors = getExecutorIds(sc)
assert(executors.size === 2)
assert(sc.killExecutor(executors.head))
- assert(sc.killExecutor(executors.head))
+ assert(!sc.killExecutor(executors.head))
val apps = getApplications()
assert(apps.head.executors.size === 1)
// The limit should not be lowered twice
@@ -386,23 +386,28 @@ class StandaloneDynamicAllocationSuite
// the driver refuses to kill executors it does not know about
syncExecutors(sc)
val executors = getExecutorIds(sc)
+ val executorIdsBefore = executors.toSet
assert(executors.size === 2)
- // kill executor 1, and replace it
+ // kill and replace an executor
assert(sc.killAndReplaceExecutor(executors.head))
eventually(timeout(10.seconds), interval(10.millis)) {
val apps = getApplications()
assert(apps.head.executors.size === 2)
+ val executorIdsAfter = getExecutorIds(sc).toSet
+ // make sure the executor was killed and replaced
+ assert(executorIdsBefore != executorIdsAfter)
}
- var apps = getApplications()
- // kill executor 1
- assert(sc.killExecutor(executors.head))
- apps = getApplications()
- assert(apps.head.executors.size === 2)
- assert(apps.head.getExecutorLimit === 2)
- // kill executor 2
- assert(sc.killExecutor(executors(1)))
- apps = getApplications()
+ // kill old executor (which is killedAndReplaced) should fail
+ assert(!sc.killExecutor(executors.head))
+
+ // refresh executors list
+ val newExecutors = getExecutorIds(sc)
+ syncExecutors(sc)
+
+ // kill newly created executor and do not replace it
+ assert(sc.killExecutor(newExecutors(1)))
+ val apps = getApplications()
assert(apps.head.executors.size === 1)
assert(apps.head.getExecutorLimit === 1)
}
@@ -430,7 +435,7 @@ class StandaloneDynamicAllocationSuite
val executorIdToTaskCount = taskScheduler invokePrivate getMap()
executorIdToTaskCount(executors.head) = 1
// kill the busy executor without force; this should fail
- assert(killExecutor(sc, executors.head, force = false))
+ assert(!killExecutor(sc, executors.head, force = false))
apps = getApplications()
assert(apps.head.executors.size === 2)