Skip to content

Commit a0ee7de

Browse files
authored
Merge pull request spark-jobserver#671 from instructure/fix_2.0_named_spec
Fix NamedObjectsJobSepc under docker
2 parents 5b6a08a + 4bfe5e8 commit a0ee7de

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

job-server-extras/src/test/scala/spark/jobserver/NamedObjectsJobSpec.scala

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import spark.jobserver.CommonMessages.JobResult
66
import spark.jobserver.io.JobDAOActor
77

88
class NamedObjectsJobSpec extends JobSpecBase(JobManagerSpec.getNewSystem) {
9+
import scala.concurrent.duration._
910

1011
override def beforeAll() {
1112
dao = new InMemoryDAO
@@ -16,12 +17,12 @@ class NamedObjectsJobSpec extends JobSpecBase(JobManagerSpec.getNewSystem) {
1617
supervisor = TestProbe().ref
1718

1819
manager ! JobManagerActor.Initialize(None)
19-
20-
expectMsgClass(classOf[JobManagerActor.Initialized])
20+
21+
expectMsgClass(10.seconds, classOf[JobManagerActor.Initialized])
2122

2223
uploadTestJar()
2324
}
24-
25+
2526
val jobName = "spark.jobserver.NamedObjectsTestJob"
2627

2728
private def getCreateConfig(createDF: Boolean, createRDD: Boolean, createBroadcast: Boolean = false) : Config = {
@@ -30,12 +31,12 @@ class NamedObjectsJobSpec extends JobSpecBase(JobManagerSpec.getNewSystem) {
3031
NamedObjectsTestJobConfig.CREATE_RDD + " = " + createRDD + ", " +
3132
NamedObjectsTestJobConfig.CREATE_BROADCAST + " = " + createBroadcast)
3233
}
33-
34+
3435
private def getDeleteConfig(names: List[String]) : Config = {
35-
ConfigFactory.parseString("spark.jobserver.named-object-creation-timeout = 60 s, " +
36+
ConfigFactory.parseString("spark.jobserver.named-object-creation-timeout = 60 s, " +
3637
NamedObjectsTestJobConfig.DELETE+" = [" + names.mkString(", ") + "]")
3738
}
38-
39+
3940
describe("NamedObjects (RDD)") {
4041
it("should survive from one job to another one") {
4142
manager ! JobManagerActor.StartJob("demo", jobName, getCreateConfig(false, true), errorEvents ++ syncEvents)
@@ -60,15 +61,16 @@ class NamedObjectsJobSpec extends JobSpecBase(JobManagerSpec.getNewSystem) {
6061
describe("NamedObjects (DataFrame)") {
6162
it("should survive from one job to another one") {
6263
manager ! JobManagerActor.StartJob("demo", jobName, getCreateConfig(true, false), errorEvents ++ syncEvents)
63-
val JobResult(_, names: Array[String]) = expectMsgClass(classOf[JobResult])
64+
// for some reason, this just needs some more time to finish occasinally
65+
val JobResult(_, names: Array[String]) = expectMsgClass(10.seconds, classOf[JobResult])
6466

6567
names should contain("df1")
6668

6769
manager ! JobManagerActor.StartJob("demo", jobName, getCreateConfig(false, false), errorEvents ++ syncEvents)
6870
val JobResult(_, names2: Array[String]) = expectMsgClass(classOf[JobResult])
6971

7072
names2 should equal(names)
71-
73+
7274
//clean-up
7375
manager ! JobManagerActor.StartJob("demo", jobName, getDeleteConfig(List("df1")), errorEvents ++ syncEvents)
7476
expectMsgClass(classOf[JobResult])
@@ -79,15 +81,15 @@ class NamedObjectsJobSpec extends JobSpecBase(JobManagerSpec.getNewSystem) {
7981
it("should survive from one job to another one") {
8082
manager ! JobManagerActor.StartJob("demo", jobName, getCreateConfig(true, true), errorEvents ++ syncEvents)
8183
val JobResult(_, names: Array[String]) = expectMsgClass(classOf[JobResult])
82-
84+
8385
names should contain("rdd1")
8486
names should contain("df1")
8587

8688
manager ! JobManagerActor.StartJob("demo", jobName, getCreateConfig(false, false), errorEvents ++ syncEvents)
8789
val JobResult(_, names2: Array[String]) = expectMsgClass(classOf[JobResult])
8890

8991
names2 should equal(names)
90-
92+
9193
//clean-up
9294
manager ! JobManagerActor.StartJob("demo", jobName, getDeleteConfig(List("rdd1", "df1")), errorEvents ++ syncEvents)
9395
expectMsgClass(classOf[JobResult])
@@ -99,7 +101,7 @@ class NamedObjectsJobSpec extends JobSpecBase(JobManagerSpec.getNewSystem) {
99101

100102
manager ! JobManagerActor.StartJob("demo", jobName, getCreateConfig(true, true, true), errorEvents ++ syncEvents)
101103
val JobResult(_, names: Array[String]) = expectMsgClass(classOf[JobResult])
102-
104+
103105
names should contain("rdd1")
104106
names should contain("df1")
105107
names should contain("broadcast1")
@@ -108,7 +110,7 @@ class NamedObjectsJobSpec extends JobSpecBase(JobManagerSpec.getNewSystem) {
108110
val JobResult(_, names2: Array[String]) = expectMsgClass(classOf[JobResult])
109111

110112
names2 should equal(names)
111-
113+
112114
//clean-up
113115
manager ! JobManagerActor.StartJob("demo", jobName, getDeleteConfig(List("rdd1", "df1", "broadcast1"))
114116
, errorEvents ++ syncEvents)

job-server/src/test/scala/spark/jobserver/TestJarFinder.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ trait TestJarFinder {
6969
assert(allJars.size == 1, allJars.toList.toString)
7070
allJars.head
7171
}
72-
}
72+
}

0 commit comments

Comments
 (0)