Skip to content

Commit

Permalink
Moved unit test for SPARK-4514 from AsyncRDDActionsSuite into StatusT…
Browse files Browse the repository at this point in the history
…rackerSuite

This reverts commit 38b1442.
  • Loading branch information
reggert committed Nov 22, 2015
1 parent 38b1442 commit 5816489
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
13 changes: 13 additions & 0 deletions core/src/test/scala/org/apache/spark/StatusTrackerSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,17 @@ class StatusTrackerSuite extends SparkFunSuite with Matchers with LocalSparkCont
Set(firstJobId, secondJobId))
}
}

test("getJobIdsForGroup() with takeAsync()") {
sc = new SparkContext("local", "test", new SparkConf(false))
sc.setJobGroup("my-job-group2", "description")
sc.statusTracker.getJobIdsForGroup("my-job-group2") should be (Seq.empty)
val firstJobFuture = sc.parallelize(1 to 1000, 1).takeAsync(1)
val firstJobId = eventually(timeout(10 seconds)) {
firstJobFuture.jobIds.head
}
eventually(timeout(10 seconds)) {
sc.statusTracker.getJobIdsForGroup("my-job-group2") should be (Seq(firstJobId))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ import scala.concurrent._
import scala.concurrent.duration.Duration
import scala.concurrent.ExecutionContext.Implicits.global

import org.scalatest.{Matchers, BeforeAndAfterAll}
import org.scalatest.concurrent.{Eventually, Timeouts}
import org.scalatest.BeforeAndAfterAll
import org.scalatest.concurrent.Timeouts
import org.scalatest.time.SpanSugar._

import org.apache.spark._

class AsyncRDDActionsSuite extends SparkFunSuite with BeforeAndAfterAll with Timeouts
with Eventually with Matchers {
class AsyncRDDActionsSuite extends SparkFunSuite with BeforeAndAfterAll with Timeouts {

@transient private var sc: SparkContext = _

Expand Down Expand Up @@ -228,16 +227,4 @@ class AsyncRDDActionsSuite extends SparkFunSuite with BeforeAndAfterAll with Tim
test("ComplexFutureAction callback must not consume a thread while waiting") {
testAsyncAction((_.takeAsync(100)))
}

test("getJobIdsForGroup() with takeAsync()") {
sc.setJobGroup("my-job-group2", "description")
sc.statusTracker.getJobIdsForGroup("my-job-group2") should be (Seq.empty)
val firstJobFuture = sc.parallelize(1 to 1000, 1).takeAsync(1)
val firstJobId = eventually(timeout(10 seconds)) {
firstJobFuture.jobIds.head
}
eventually(timeout(10 seconds)) {
sc.statusTracker.getJobIdsForGroup("my-job-group2") should be (Seq(firstJobId))
}
}
}

0 comments on commit 5816489

Please sign in to comment.