Skip to content

Commit

Permalink
Simplifying test
Browse files Browse the repository at this point in the history
  • Loading branch information
mateiz committed Feb 6, 2012
1 parent 7449ecf commit 43a3335
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions core/src/test/scala/spark/FailureSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object FailureSuiteState {
var tasksRun = 0
var tasksFailed = 0

def clear() {
def clear(): Unit = synchronized {
tasksRun = 0
tasksFailed = 0
}
Expand All @@ -28,13 +28,9 @@ class FailureSuite extends FunSuite {
val results = sc.makeRDD(1 to 3, 3).map { x =>
FailureSuiteState.synchronized {
FailureSuiteState.tasksRun += 1
}
if (x == 1) {
FailureSuiteState.synchronized {
if (FailureSuiteState.tasksFailed == 0) {
FailureSuiteState.tasksFailed += 1
throw new Exception("Intentional task failure")
}
if (x == 1 && FailureSuiteState.tasksFailed == 0) {
FailureSuiteState.tasksFailed += 1
throw new Exception("Intentional task failure")
}
}
x * x
Expand All @@ -54,13 +50,9 @@ class FailureSuite extends FunSuite {
case (k, v) =>
FailureSuiteState.synchronized {
FailureSuiteState.tasksRun += 1
}
if (k == 1) {
FailureSuiteState.synchronized {
if (FailureSuiteState.tasksFailed == 0) {
FailureSuiteState.tasksFailed += 1
throw new Exception("Intentional task failure")
}
if (k == 1 && FailureSuiteState.tasksFailed == 0) {
FailureSuiteState.tasksFailed += 1
throw new Exception("Intentional task failure")
}
}
(k, v(0) * v(0))
Expand Down

0 comments on commit 43a3335

Please sign in to comment.