From 4e925a398d97623a426069e7902b73e8b20523cb Mon Sep 17 00:00:00 2001 From: Tom Dyas Date: Thu, 24 Sep 2015 17:01:46 -0400 Subject: [PATCH] opt-in to calling Job.validate in JobTest --- .../src/main/scala/com/twitter/scalding/JobTest.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scalding-core/src/main/scala/com/twitter/scalding/JobTest.scala b/scalding-core/src/main/scala/com/twitter/scalding/JobTest.scala index c0bad67be9..148f3b0eb1 100644 --- a/scalding-core/src/main/scala/com/twitter/scalding/JobTest.scala +++ b/scalding-core/src/main/scala/com/twitter/scalding/JobTest.scala @@ -65,6 +65,7 @@ class JobTest(cons: (Args) => Job) { private var sourceMap: (Source) => Option[Buffer[Tuple]] = { _ => None } private var sinkSet = Set[Source]() private var fileSet = Set[String]() + private var validateJob = false def arg(inArg: String, value: List[String]) = { argsMap += inArg -> value @@ -164,6 +165,11 @@ class JobTest(cons: (Args) => Job) { // This SITS is unfortunately needed to get around Specs def finish: Unit = { () } + def validate(v: Boolean) = { + validateJob = v + this + } + // Registers test files, initializes the global mode, and creates a job. private def initJob(useHadoop: Boolean, job: Option[JobConf] = None): Job = { // Create a global mode to use for testing. @@ -198,7 +204,9 @@ class JobTest(cons: (Args) => Job) { System.setProperty("cascading.planner.stats.path", "target/test/cascading/traceplan/" + job.name + "/stats") } - job.validate + if (validateJob) { + job.validate + } job.run // Make sure to clean the state: job.clear