Skip to content

Commit

Permalink
Fix GCPBATCH backend naming in configuration specs and additional con…
Browse files Browse the repository at this point in the history
…figs in test config.
  • Loading branch information
dspeck1 committed Nov 25, 2024
1 parent 6311a45 commit d636287
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ object GcpBatchInitializationActorSpec {
| // This is the maximum polling interval (in seconds):
| maximum-polling-interval = 600
|
| batch {
| GCPBATCH {
| // A reference to an auth defined in the `google` stanza at the top.
| // This auth is used to create jobs and manipulate auth JSONs.
| auth = "application-default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GcpBatchConfigurationAttributesSpec
it should "parse correct Batch config" in {
val backendConfig = ConfigFactory.parseString(configString())

val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
gcpBatchAttributes.project should be("myProject")
gcpBatchAttributes.executionBucket should be("gs://myBucket")
gcpBatchAttributes.maxPollingInterval should be(600)
Expand All @@ -42,7 +42,7 @@ class GcpBatchConfigurationAttributesSpec

val backendConfig = ConfigFactory.parseString(configString(customContent = "preemptible = 3"))

val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
gcpBatchAttributes.project should be("myProject")
gcpBatchAttributes.executionBucket should be("gs://myBucket")
gcpBatchAttributes.maxPollingInterval should be(600)
Expand All @@ -61,7 +61,7 @@ class GcpBatchConfigurationAttributesSpec
""".stripMargin

val backendConfig = ConfigFactory.parseString(configString(customContent = customContent))
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")

gcpBatchAttributes.batchRequestTimeoutConfiguration.readTimeoutMillis.get.value should be(100.hours.toMillis.toInt)
gcpBatchAttributes.batchRequestTimeoutConfiguration.connectTimeoutMillis.get.value should be(
Expand All @@ -82,23 +82,23 @@ class GcpBatchConfigurationAttributesSpec
""".stripMargin

val backendConfig = ConfigFactory.parseString(configString(customContent = customContent))
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")

gcpBatchAttributes.batchRequestTimeoutConfiguration should be(BatchRequestTimeoutConfiguration(None, None))
}

it should "parse batch-timeout" in {

val backendConfig = ConfigFactory.parseString(configString(customContent = "batch-timeout = 3 days"))
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")

gcpBatchAttributes.batchTimeout should be(3.days)
}

it should "parse an undefined batch-timeout" in {

val backendConfig = ConfigFactory.parseString(configString())
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")

gcpBatchAttributes.batchTimeout should be(7.days)
}
Expand All @@ -107,27 +107,27 @@ class GcpBatchConfigurationAttributesSpec

val backendConfig = ConfigFactory.parseString(configString(batch = """compute-service-account = "testing" """))

val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
gcpBatchAttributes.computeServiceAccount should be("testing")
}

it should "parse localization-attempts" in {

val backendConfig = ConfigFactory.parseString(configString(batch = "localization-attempts = 31380"))

val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
gcpBatchAttributes.gcsTransferConfiguration.transferAttempts.value should be(31380)
}

it should "parse logs-policy = CLOUD_LOGGING" in {
val backendConfig = ConfigFactory.parseString(configString(batch = "logs-policy = CLOUD_LOGGING"))
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
gcpBatchAttributes.logsPolicy should be(GcpBatchLogsPolicy.CloudLogging)
}

it should "parse logs-policy = PATH" in {
val backendConfig = ConfigFactory.parseString(configString(batch = "logs-policy = PATH"))
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
gcpBatchAttributes.logsPolicy should be(GcpBatchLogsPolicy.Path)
}

Expand All @@ -136,7 +136,7 @@ class GcpBatchConfigurationAttributesSpec
"Google Cloud Batch configuration is not valid: Errors:\nUnrecognized logs policy entry: INVALID. Supported strategies are CLOUD_LOGGING and PATH."
val backendConfig = ConfigFactory.parseString(configString(batch = "logs-policy = INVALID"))
val ex = intercept[IllegalArgumentException] {
GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
}

ex.getMessage should be(expected)
Expand Down Expand Up @@ -238,7 +238,7 @@ class GcpBatchConfigurationAttributesSpec
it should s"parse virtual-private-cloud $description" in {

val backendConfig = ConfigFactory.parseString(configString(customConfig))
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
val gcpBatchAttributes = GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
gcpBatchAttributes.virtualPrivateCloudConfiguration should be(vpcConfig)
}
}
Expand All @@ -248,7 +248,7 @@ class GcpBatchConfigurationAttributesSpec

val backendConfig = ConfigFactory.parseString(configString(customConfig))
val exception = intercept[IllegalArgumentException with MessageAggregation] {
GcpBatchConfigurationAttributes(googleConfig, backendConfig, "batch")
GcpBatchConfigurationAttributes(googleConfig, backendConfig, "GCPBATCH")
}
exception.errorMessages.toList should be(errorMessages)
}
Expand All @@ -266,7 +266,7 @@ class GcpBatchConfigurationAttributesSpec
""".stripMargin)

val exception = intercept[IllegalArgumentException with MessageAggregation] {
GcpBatchConfigurationAttributes(googleConfig, nakedConfig, "batch")
GcpBatchConfigurationAttributes(googleConfig, nakedConfig, "GCPBATCH")
}
val errorsList = exception.errorMessages.toList
errorsList should contain("String: 2: No configuration setting found for key 'project'")
Expand All @@ -282,7 +282,7 @@ class GcpBatchConfigurationAttributesSpec
| root = "gs://myBucket"
| maximum-polling-interval = 600
| $customContent
| batch {
| GCPBATCH {
| // A reference to an auth defined in the `google` stanza at the top. This auth is used to create
| // Pipelines and manipulate auth JSONs.
| auth = "mock"
Expand Down Expand Up @@ -325,7 +325,7 @@ class GcpBatchConfigurationAttributesSpec

val backendConfig = ConfigFactory.parseString(configString())

val validation = GcpBatchConfigurationAttributes.validateReferenceDiskManifestConfigs(backendConfig, "batch")
val validation = GcpBatchConfigurationAttributes.validateReferenceDiskManifestConfigs(backendConfig, "GCPBATCH")

validation shouldBe None.validNel
}
Expand All @@ -336,7 +336,7 @@ class GcpBatchConfigurationAttributesSpec

val backendConfig = ConfigFactory.parseString(configString(customContent = manifestConfig))

val validation = GcpBatchConfigurationAttributes.validateReferenceDiskManifestConfigs(backendConfig, "batch")
val validation = GcpBatchConfigurationAttributes.validateReferenceDiskManifestConfigs(backendConfig, "GCPBATCH")

validation shouldBe Option(List.empty).validNel
}
Expand Down Expand Up @@ -373,7 +373,7 @@ class GcpBatchConfigurationAttributesSpec
|]
|""".stripMargin
val backendConfig = ConfigFactory.parseString(configString(manifestConfig))
val validation = GcpBatchConfigurationAttributes.validateReferenceDiskManifestConfigs(backendConfig, "batch")
val validation = GcpBatchConfigurationAttributes.validateReferenceDiskManifestConfigs(backendConfig, "GCPBATCH")
val manifests: List[ManifestFile] = validation.toEither.toOption.get.get

manifests shouldBe List(
Expand Down Expand Up @@ -442,7 +442,7 @@ class GcpBatchConfigurationAttributesSpec
badValues foreach { badValue =>
val customContent = s""""reference-disk-localization-manifests" = $badValue"""
val backendConfig = ConfigFactory.parseString(configString(customContent))
val validation = GcpBatchConfigurationAttributes.validateReferenceDiskManifestConfigs(backendConfig, "batch")
val validation = GcpBatchConfigurationAttributes.validateReferenceDiskManifestConfigs(backendConfig, "GCPBATCH")
validation.isInvalid shouldBe true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class GcpBatchConfigurationSpec
| // This is the maximum polling interval (in seconds):
| maximum-polling-interval = 600
|
| batch {
| GCPBATCH {
| // A reference to an auth defined in the `google` stanza at the top.
| // This auth is used to create jobs and manipulate auth JSONs.
| auth = "application-default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ object GcpBatchTestConfig {
|project = "my-cromwell-workflows"
|root = "gs://my-cromwell-workflows-bucket"
|
|batch {
|GCPBATCH {
| auth = "application-default"
|}
|
Expand Down Expand Up @@ -84,7 +84,7 @@ object GcpBatchTestConfig {
|backend {
| default = "batch"
| providers {
| batch {
| GCPBATCH {
| actor-factory = "cromwell.backend.google.batch.GcpBatchBackendLifecycleActorFactory"
| config {
| $BatchBackendConfigString
Expand All @@ -108,7 +108,7 @@ object GcpBatchTestConfig {
Await.result(BatchBackendConfigurationDescriptor.pathBuilders(WorkflowOptions.empty), 5.seconds)
val googleConfiguration: GoogleConfiguration = GoogleConfiguration(BatchGlobalConfig)
val batchAttributes: GcpBatchConfigurationAttributes =
GcpBatchConfigurationAttributes(googleConfiguration, BatchBackendConfig, "batch")
GcpBatchConfigurationAttributes(googleConfiguration, BatchBackendConfig, "GCPBATCH")
val gcpBatchConfiguration =
new GcpBatchConfiguration(BatchBackendConfigurationDescriptor, googleConfiguration, batchAttributes)
}

0 comments on commit d636287

Please sign in to comment.