forked from broadinstitute/cromwell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfa707b
commit 4feed63
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
supportedBackends/tes/src/test/scala/cromwell/backend/impl/tes/TesTaskSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package cromwell.backend.impl.tes | ||
|
||
import common.assertion.CromwellTimeoutSpec | ||
import cromwell.backend.BackendSpec | ||
import cromwell.backend.validation.ContinueOnReturnCodeSet | ||
import cromwell.core.WorkflowOptions | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
import spray.json.{JsObject, JsString, JsValue} | ||
|
||
class TesTaskSpec extends AnyFlatSpec with CromwellTimeoutSpec with Matchers with BackendSpec { | ||
|
||
val runtimeAttributes = new TesRuntimeAttributes( | ||
ContinueOnReturnCodeSet(Set(0)), | ||
"ubuntu:latest", | ||
None, | ||
false, | ||
None, | ||
None, | ||
None, | ||
false | ||
) | ||
|
||
def workflowDescriptorWithIdentity(excIdentity: Option[String]) = { | ||
val optionsMap: Map[String, JsValue] = excIdentity.map(i => TesWorkflowOptionKeys.Identity -> JsString(i)).toMap | ||
buildWdlWorkflowDescriptor(TestWorkflows.HelloWorld, None, WorkflowOptions(JsObject(optionsMap))) | ||
} | ||
|
||
"TesTask" should "create the correct resources when an identity is passed in WorkflowOptions" in { | ||
val wd = workflowDescriptorWithIdentity(Some("abc123")) | ||
assert( | ||
TesTask.makeResources(runtimeAttributes, wd) | ||
== Resources(None, None, None, Some(false), None, Some(Map(TesWorkflowOptionKeys.Identity -> "abc123"))) | ||
) | ||
} | ||
|
||
"TesTask" should "create the correct resources when an empty identity is passed in WorkflowOptions" in { | ||
val wd = workflowDescriptorWithIdentity(Some("")) | ||
assert( | ||
TesTask.makeResources(runtimeAttributes, wd) | ||
== Resources(None, None, None, Some(false), None, Some(Map(TesWorkflowOptionKeys.Identity -> ""))) | ||
) | ||
} | ||
|
||
"TesTask" should "create the correct resources when no identity is passed in WorkflowOptions" in { | ||
val wd = workflowDescriptorWithIdentity(None) | ||
assert( | ||
TesTask.makeResources(runtimeAttributes, wd) | ||
== Resources(None, None, None, Some(false), None, None) | ||
) | ||
} | ||
} |