Skip to content

Commit

Permalink
[BT-687] specify correct types (#6829)
Browse files Browse the repository at this point in the history
* specify correct types

* fix test with new type

* remove type declarations in function call

* remove unnecessary sas-token config
  • Loading branch information
mspector authored Aug 18, 2022
1 parent 19d4fdb commit 3a19be6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import scala.jdk.CollectionConverters._

final case class BlobFileSystemConfig(config: Config)
final case class BlobPathBuilderFactory(globalConfig: Config, instanceConfig: Config, singletonConfig: BlobFileSystemConfig) extends PathBuilderFactory {
val sasToken: String = instanceConfig.as[String]("sas-token")
val container: String = instanceConfig.as[String]("store")
val endpoint: String = instanceConfig.as[String]("endpoint")
val workspaceId: String = instanceConfig.as[String]("workspace-id")
val workspaceManagerURL: String = singletonConfig.config.as[String]("workspace-manager-url")
val workspaceId: Option[String] = instanceConfig.as[Option[String]]("workspace-id")
val workspaceManagerURL: Option[String] = singletonConfig.config.as[Option[String]]("workspace-manager-url")

val blobTokenGenerator: BlobTokenGenerator = BlobTokenGenerator.createBlobTokenGenerator(
container, endpoint, Option(workspaceId), Option(workspaceManagerURL))
container, endpoint, workspaceId, workspaceManagerURL)

override def withOptions(options: WorkflowOptions)(implicit as: ActorSystem, ec: ExecutionContext): Future[BlobPathBuilder] = {
Future {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ class BlobPathBuilderFactorySpec extends AnyFlatSpec with Matchers {
it should "parse configs for a functioning factory" in {
val endpoint = BlobPathBuilderSpec.buildEndpoint("coaexternalstorage")
val store = "inputs"
val sasToken = "{SAS TOKEN HERE}"
val workspaceId = "mockWorkspaceId"
val workspaceManagerURL = "https://test.ws.org"
val instanceConfig = ConfigFactory.parseString(
s"""
|sas-token = "$sasToken"
|store = "$store"
|endpoint = "$endpoint"
|workspace-id = "$workspaceId"
Expand All @@ -24,8 +22,7 @@ class BlobPathBuilderFactorySpec extends AnyFlatSpec with Matchers {
val factory = BlobPathBuilderFactory(globalConfig, instanceConfig, new BlobFileSystemConfig(singletonConfig))
factory.container should equal(store)
factory.endpoint should equal(endpoint)
factory.sasToken should equal(sasToken)
factory.workspaceId should equal(workspaceId)
factory.workspaceManagerURL should equal(workspaceManagerURL)
factory.workspaceId should equal(Some(workspaceId))
factory.workspaceManagerURL should equal(Some(workspaceManagerURL))
}
}

0 comments on commit 3a19be6

Please sign in to comment.