Simplifying test
This commit is contained in:
parent
7449ecfb7e
commit
43a3335090
|
@ -14,7 +14,7 @@ object FailureSuiteState {
|
||||||
var tasksRun = 0
|
var tasksRun = 0
|
||||||
var tasksFailed = 0
|
var tasksFailed = 0
|
||||||
|
|
||||||
def clear() {
|
def clear(): Unit = synchronized {
|
||||||
tasksRun = 0
|
tasksRun = 0
|
||||||
tasksFailed = 0
|
tasksFailed = 0
|
||||||
}
|
}
|
||||||
|
@ -28,15 +28,11 @@ class FailureSuite extends FunSuite {
|
||||||
val results = sc.makeRDD(1 to 3, 3).map { x =>
|
val results = sc.makeRDD(1 to 3, 3).map { x =>
|
||||||
FailureSuiteState.synchronized {
|
FailureSuiteState.synchronized {
|
||||||
FailureSuiteState.tasksRun += 1
|
FailureSuiteState.tasksRun += 1
|
||||||
}
|
if (x == 1 && FailureSuiteState.tasksFailed == 0) {
|
||||||
if (x == 1) {
|
|
||||||
FailureSuiteState.synchronized {
|
|
||||||
if (FailureSuiteState.tasksFailed == 0) {
|
|
||||||
FailureSuiteState.tasksFailed += 1
|
FailureSuiteState.tasksFailed += 1
|
||||||
throw new Exception("Intentional task failure")
|
throw new Exception("Intentional task failure")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
x * x
|
x * x
|
||||||
}.collect()
|
}.collect()
|
||||||
FailureSuiteState.synchronized {
|
FailureSuiteState.synchronized {
|
||||||
|
@ -54,15 +50,11 @@ class FailureSuite extends FunSuite {
|
||||||
case (k, v) =>
|
case (k, v) =>
|
||||||
FailureSuiteState.synchronized {
|
FailureSuiteState.synchronized {
|
||||||
FailureSuiteState.tasksRun += 1
|
FailureSuiteState.tasksRun += 1
|
||||||
}
|
if (k == 1 && FailureSuiteState.tasksFailed == 0) {
|
||||||
if (k == 1) {
|
|
||||||
FailureSuiteState.synchronized {
|
|
||||||
if (FailureSuiteState.tasksFailed == 0) {
|
|
||||||
FailureSuiteState.tasksFailed += 1
|
FailureSuiteState.tasksFailed += 1
|
||||||
throw new Exception("Intentional task failure")
|
throw new Exception("Intentional task failure")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
(k, v(0) * v(0))
|
(k, v(0) * v(0))
|
||||||
}.collect()
|
}.collect()
|
||||||
FailureSuiteState.synchronized {
|
FailureSuiteState.synchronized {
|
||||||
|
|
Loading…
Reference in a new issue