Skip to content

Commit

Permalink
Merge pull request #1536 from broadinstitute/update/minor_patch
Browse files Browse the repository at this point in the history
CORE-69: Minor and patch updates - google-cloud-nio to 0.127.29 - scalafmt-core to 3.8.4 - sentry-logback to 7.20.0
  • Loading branch information
davidangb authored Jan 14, 2025
2 parents a28a386 + bca026f commit 4466555
Show file tree
Hide file tree
Showing 42 changed files with 280 additions and 473 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# scalafmt mass change
3686bb47a5b215733a46c3393a51e950fcaa635f

# Scala Steward: Reformat with scalafmt 3.8.4
c7a758f4143587c0355fee5580523cf7be0ead66
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = 3.8.3
version = 3.8.4
align = none
align.openParenCallSite = true
align.openParenDefnSite = true
Expand Down
2 changes: 1 addition & 1 deletion automation/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
logLevel := Level.Warn
logLevel := Level.Warn
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,34 @@ object LibraryData {
"library:RS-PD" -> false,
"library:IRB" -> false,
"library:RS-G" -> "N/A",
"library:NAGR" -> "No")
"library:NAGR" -> "No"
)

val metadataBasic = Map(
"library:datasetName"->"name",
"library:datasetVersion"->"v1.0",
"library:datasetDescription"->"desc",
"library:datasetCustodian"->"cust",
"library:datasetDepositor"->"depo",
"library:contactEmail"->"name@example.com",
"library:datasetOwner"->"owner",
"library:institute"->Seq("inst","it","ute"),
"library:indication"->"indic",
"library:numSubjects"->123,
"library:projectName"->"proj",
"library:datatype"->Seq("data","type"),
"library:dataCategory"->Seq("data","category"),
"library:dataUseRestriction"->"dur",
"library:studyDesign"->"study",
"library:cellType"->"cell",
"library:requiresExternalApproval"->false,
"library:useLimitationOption"-> "skip",
"library:technology"->Seq("is an optional","array attribute"))
"library:datasetName" -> "name",
"library:datasetVersion" -> "v1.0",
"library:datasetDescription" -> "desc",
"library:datasetCustodian" -> "cust",
"library:datasetDepositor" -> "depo",
"library:contactEmail" -> "name@example.com",
"library:datasetOwner" -> "owner",
"library:institute" -> Seq("inst", "it", "ute"),
"library:indication" -> "indic",
"library:numSubjects" -> 123,
"library:projectName" -> "proj",
"library:datatype" -> Seq("data", "type"),
"library:dataCategory" -> Seq("data", "category"),
"library:dataUseRestriction" -> "dur",
"library:studyDesign" -> "study",
"library:cellType" -> "cell",
"library:requiresExternalApproval" -> false,
"library:useLimitationOption" -> "skip",
"library:technology" -> Seq("is an optional", "array attribute")
)

// to set a discoverable by group, you can add the following with your specific group
// "library:discoverableByGroups"->Seq("all_broad_users")

val metadataORSP = metadataBasic ++ Map(
"library:useLimitationOption"->"orsp",
"library:orsp"->"some orsp")

val metadataORSP = metadataBasic ++ Map("library:useLimitationOption" -> "orsp", "library:orsp" -> "some orsp")

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.broadinstitute.dsde.test.api.orch


import akka.http.scaladsl.model.StatusCodes
import org.broadinstitute.dsde.test.OrchConfig
import org.broadinstitute.dsde.workbench.auth.AuthToken
Expand All @@ -18,19 +17,13 @@ import org.scalatest.time.{Minutes, Seconds, Span}
import java.time.Instant
import java.util.UUID


class OrchestrationApiSpec
extends AnyFreeSpec
with Matchers
with ScalaFutures
with Eventually {
class OrchestrationApiSpec extends AnyFreeSpec with Matchers with ScalaFutures with Eventually {

implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(5, Seconds)))
val billingAccountId: String = ServiceTestConfig.Projects.billingAccountId

def nowPrint(text: String): Unit = {
def nowPrint(text: String): Unit =
println(s"${Instant.now} : $text")
}

"Orchestration" - {
"should link an eRA Commons account with access to the TARGET closed-access dataset" ignore {
Expand All @@ -51,14 +44,14 @@ class OrchestrationApiSpec
finally resetNihLinkToInactive()
}

"should link an eRA Commons account with access to none of the supported closed-access datasets" in {
val user = UserPool.chooseAuthDomainUser
implicit val userToken: AuthToken = user.makeAuthToken()
"should link an eRA Commons account with access to none of the supported closed-access datasets" in {
val user = UserPool.chooseAuthDomainUser
implicit val userToken: AuthToken = user.makeAuthToken()

Orchestration.NIH.addUserInNIH(OrchConfig.Users.genericJsonWebTokenKey)
try verifyDatasetPermissions(Set(NihDatasetPermission("TCGA", false), NihDatasetPermission("TARGET", false)))
finally resetNihLinkToInactive()
}
Orchestration.NIH.addUserInNIH(OrchConfig.Users.genericJsonWebTokenKey)
try verifyDatasetPermissions(Set(NihDatasetPermission("TCGA", false), NihDatasetPermission("TARGET", false)))
finally resetNihLinkToInactive()
}

"should sync the whitelist and remove a user who no longer has access to either closed-access dataset" ignore {
val user = UserPool.chooseAuthDomainUser
Expand All @@ -73,8 +66,8 @@ class OrchestrationApiSpec
}
}

//We need to reset the user's link to a state where it doesn't have access to any of the datasets
//To do so, we will link with a JWT that doesn't have access to any datasets and then sync both whitelists
// We need to reset the user's link to a state where it doesn't have access to any of the datasets
// To do so, we will link with a JWT that doesn't have access to any datasets and then sync both whitelists
private def resetNihLinkToInactive()(implicit authToken: AuthToken) = {
Orchestration.NIH.addUserInNIH(OrchConfig.Users.genericJsonWebTokenKey)

Expand All @@ -83,7 +76,9 @@ class OrchestrationApiSpec
verifyDatasetPermissions(Set(NihDatasetPermission("TCGA", false), NihDatasetPermission("TARGET", false)))
}

private def verifyDatasetPermissions(expectedPermissions: Set[NihDatasetPermission])(implicit authToken: AuthToken) = {
private def verifyDatasetPermissions(
expectedPermissions: Set[NihDatasetPermission]
)(implicit authToken: AuthToken) = {
// Sam caches group membership for a minute (but not in fiab) so may need to wait
implicit val patienceConfig = PatienceConfig(Span(2, Minutes), Span(10, Seconds))
eventually {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ import org.scalatest.matchers.should.Matchers
import org.scalatest.time.{Seconds, Span}
import spray.json._

class PublishedWorkspaceSpec extends AnyFreeSpec with WorkspaceFixtures with Matchers with Eventually with RandomUtil {

class PublishedWorkspaceSpec
extends AnyFreeSpec
with WorkspaceFixtures
with Matchers
with Eventually
with RandomUtil {

implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(30, Seconds)), interval = scaled(Span(2, Seconds)))
implicit override val patienceConfig: PatienceConfig =
PatienceConfig(timeout = scaled(Span(30, Seconds)), interval = scaled(Span(2, Seconds)))
val billingAccountId: String = ServiceTestConfig.Projects.billingAccountId

"a user with publish permissions" - {
Expand All @@ -36,7 +31,6 @@ class PublishedWorkspaceSpec

withTemporaryBillingProject(billingAccountId, users = List(curatorUser.email).some) { billingProject =>
withWorkspace(billingProject, "PublishedWorkspaceSpec_workspace") { workspaceName =>

val data = LibraryData.metadataBasic + ("library:datasetName" -> workspaceName)
Orchestration.library.setLibraryAttributes(billingProject, workspaceName, data)
Orchestration.library.publishWorkspace(billingProject, workspaceName)
Expand Down Expand Up @@ -86,8 +80,7 @@ class PublishedWorkspaceSpec
isVisibleInLibrary(clonedWorkspaceName) shouldBe false
}
}
}
finally Orchestration.workspaces.delete(billingProject, clonedWorkspaceName)
} finally Orchestration.workspaces.delete(billingProject, clonedWorkspaceName)
}
}(UserPool.chooseProjectOwner.makeAuthToken(billingScopes))
}
Expand All @@ -106,16 +99,18 @@ class PublishedWorkspaceSpec

val clonedWorkspaceName = workspaceName + "_clone"
Orchestration.workspaces.clone(billingProject, workspaceName, billingProject, clonedWorkspaceName)
try {
//Verify default group "All users"
//In swagger you make sure that getDiscoverableGroup endpoint shows []
withClue(s"Get api/library/${billingProject}/${clonedWorkspaceName}/discoverableGroups endpoint shows []") {
try
// Verify default group "All users"
// In swagger you make sure that getDiscoverableGroup endpoint shows []
withClue(
s"Get api/library/${billingProject}/${clonedWorkspaceName}/discoverableGroups endpoint shows []"
) {
eventually {
val accessGroup: Seq[String] = Orchestration.library.getDiscoverableGroups(billingProject, clonedWorkspaceName)
val accessGroup: Seq[String] =
Orchestration.library.getDiscoverableGroups(billingProject, clonedWorkspaceName)
accessGroup.size shouldBe 0
}
}
}
finally Orchestration.workspaces.delete(billingProject, clonedWorkspaceName)
}
}(UserPool.chooseProjectOwner.makeAuthToken(billingScopes))
Expand All @@ -130,7 +125,6 @@ class PublishedWorkspaceSpec

withTemporaryBillingProject(billingAccountId, users = List(curatorUser.email).some) { billingProject =>
withWorkspace(billingProject, "PublishedWorkspaceSpec_consentcodes") { workspaceName =>

val data = LibraryData.metadataBasic + ("library:datasetName" -> workspaceName) ++ LibraryData.consentCodes
Orchestration.library.setLibraryAttributes(billingProject, workspaceName, data)
Orchestration.library.publishWorkspace(billingProject, workspaceName)
Expand All @@ -153,7 +147,6 @@ class PublishedWorkspaceSpec

withTemporaryBillingProject(billingAccountId, users = List(curatorUser.email).some) { billingProject =>
withWorkspace(billingProject, "PublishedWorkspaceSpec_tags", attributes = Some(tags)) { workspaceName =>

val data = LibraryData.metadataBasic + ("library:datasetName" -> workspaceName)
Orchestration.library.setLibraryAttributes(billingProject, workspaceName, data)
Orchestration.library.publishWorkspace(billingProject, workspaceName)
Expand All @@ -170,7 +163,6 @@ class PublishedWorkspaceSpec
}
}


/**
*
* @return True: workspace is visible in library table
Expand All @@ -182,7 +174,9 @@ class PublishedWorkspaceSpec
total == 1
}

private def getDatasetFieldValues(workspaceName: String, fieldName: String)(implicit token: AuthToken): List[String] = {
private def getDatasetFieldValues(workspaceName: String,
fieldName: String
)(implicit token: AuthToken): List[String] = {
import DefaultJsonProtocol._
val datasetMap: String = Orchestration.library.searchPublishedLibraryDataset(workspaceName)
val results: JsValue = datasetMap.parseJson.asJsObject.fields("results")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ object TsvFormatterBenchmark {
AttributeName.withDefaultNS("col2") -> AttributeBoolean(true),
AttributeName.withDefaultNS("fourth") -> AttributeNumber(-123.45),
AttributeName.withDefaultNS("last") -> AttributeValueList(
Seq(AttributeString("gs://some-bucket/somefile1.ext"),
AttributeString("gs://some-bucket/somefile2.ext"),
AttributeString("gs://some-bucket/somefile3.ext")
Seq(
AttributeString("gs://some-bucket/somefile1.ext"),
AttributeString("gs://some-bucket/somefile2.ext"),
AttributeString("gs://some-bucket/somefile3.ext")
)
)
)
Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object Dependencies {
// elasticsearch requires log4j, but we redirect log4j to logback
"org.apache.logging.log4j" % "log4j-to-slf4j" % "2.24.3",
"ch.qos.logback" % "logback-classic" % "1.5.16",
"io.sentry" % "sentry-logback" % "7.19.1",
"io.sentry" % "sentry-logback" % "7.20.0",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5",

"org.parboiled" % "parboiled-core" % "1.4.1",
Expand Down Expand Up @@ -96,7 +96,7 @@ object Dependencies {
"org.scalatest" %% "scalatest" % "3.2.19" % "test",
"org.mock-server" % "mockserver-netty-no-dependencies" % "5.15.0" % "test",
// provides testing mocks
"com.google.cloud" % "google-cloud-nio" % "0.127.28" % "test",
"com.google.cloud" % "google-cloud-nio" % "0.127.29" % "test",
"org.scalatestplus" %% "mockito-4-5" % "3.2.12.0" % "test"
)
}
18 changes: 9 additions & 9 deletions project/Merging.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import sbtassembly.{MergeStrategy, PathList}

object Merging {
def customMergeStrategy(oldStrategy: (String) => MergeStrategy):(String => MergeStrategy) = {
def customMergeStrategy(oldStrategy: (String) => MergeStrategy): (String => MergeStrategy) = {
case x if x.endsWith("io.netty.versions.properties") => MergeStrategy.discard
case x if x.contains("native-image/io.netty") => MergeStrategy.first
case x if x.contains("native-image/io.netty") => MergeStrategy.first

// TODO: we no longer target Java 8, reassess this:
// we target Java 8, which does not use module-info.class. Some dependencies (Jackson) cause assembly problems on module-info
Expand All @@ -12,19 +12,19 @@ object Merging {
case x if x.contains("javax/activation") => MergeStrategy.first
case x if x.contains("javax/annotation") => MergeStrategy.first

case x if x.endsWith("kotlin-stdlib.kotlin_module") => MergeStrategy.first
case x if x.contains("bouncycastle") => MergeStrategy.first
case x if x.endsWith("kotlin-stdlib.kotlin_module") => MergeStrategy.first
case x if x.contains("bouncycastle") => MergeStrategy.first
case x if x.endsWith("kotlin-stdlib-common.kotlin_module") => MergeStrategy.first
case x if x.endsWith("okio.kotlin_module") => MergeStrategy.first
case x if x.endsWith("arrow-git.properties") => MergeStrategy.concat
case x if x.endsWith("okio.kotlin_module") => MergeStrategy.first
case x if x.endsWith("arrow-git.properties") => MergeStrategy.concat

// For the following error:
// Error: (assembly) deduplicate: different file contents found in the following:
// Error: /home/sbtuser/.cache/coursier/v1/https/repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.19.4/protobuf-java-3.19.4.jar:google/protobuf/struct.proto
// Error: /home/sbtuser/.cache/coursier/v1/https/repo1.maven.org/maven2/com/typesafe/akka/akka-protobuf-v3_2.13/2.6.19/akka-protobuf-v3_2.13-2.6.19.jar:google/protobuf/struct.proto
case PathList("google", "protobuf", _ @ _*) => MergeStrategy.first
case PathList("google", "protobuf", _ @_*) => MergeStrategy.first
case PathList("META-INF", "versions", "9", "OSGI-INF", "MANIFEST.MF") => MergeStrategy.first
case PathList("META-INF", "spring", "aot.factories") => MergeStrategy.first
case x => oldStrategy(x)
case PathList("META-INF", "spring", "aot.factories") => MergeStrategy.first
case x => oldStrategy(x)
}
}
8 changes: 3 additions & 5 deletions project/Testing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ object Testing {
lazy val IntegrationTest = config("it") extend Test

val commonTestSettings: Seq[Setting[_]] = List(

Test / testOptions ++= Seq(Tests.Filter(s => !isIntegrationTest(s))),
Test / testOptions += Tests.Argument("-oD"), // D = individual test durations
IntegrationTest / testOptions := Seq(Tests.Filter(s => isIntegrationTest(s))),
Expand All @@ -17,16 +16,15 @@ object Testing {
// However, we've already initialized Netty elsewhere (mockserver, I assume),
// so the call fails. Tell ES to skip attempting to set this value.
Test / javaOptions += "-Des.set.netty.runtime.available.processors=false",

Test / fork := true,
Test / parallelExecution := false,
IntegrationTest / fork := false, // allow easy overriding of conf values via system props
IntegrationTest / fork := false // allow easy overriding of conf values via system props

)

implicit class ProjectTestSettings(val project: Project) extends AnyVal {
def withTestSettings: Project = project
.configs(IntegrationTest).settings(inConfig(IntegrationTest)(Defaults.testTasks): _*)
.configs(IntegrationTest)
.settings(inConfig(IntegrationTest)(Defaults.testTasks): _*)
}
}

4 changes: 2 additions & 2 deletions project/Version.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ object Version {
val baseModelVersion = "0.1"

def getVersionString = {
def getLastModelCommitFromGit = { s"""git rev-parse --short HEAD""" !! }
def getLastModelCommitFromGit = s"""git rev-parse --short HEAD""" !!

// either specify git model hash as an env var or derive it
val lastModelCommit = sys.env.getOrElse("GIT_MODEL_HASH", getLastModelCommitFromGit ).trim()
val lastModelCommit = sys.env.getOrElse("GIT_MODEL_HASH", getLastModelCommitFromGit).trim()
val version = baseModelVersion + "-" + lastModelCommit

// The project isSnapshot string passed in via command line settings, if desired.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ trait LibraryApiService
}
}
}
} ~ {
} ~
get {
complete(libraryServiceConstructor(userInfo).getLibraryMetadata(namespace, name))
}
}
} ~
path("discoverableGroups") {
put {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,12 @@ class EntityServiceSpec extends BaseServiceSpec with BeforeAndAfterEach {
}

"EntityService.importJob" - {
"should send tdrexport to cWDS" in {
"should send tdrexport to cWDS" in
importJobTestImpl(importFiletype = "tdrexport")
}
"should send pfb to cWDS" in {
"should send pfb to cWDS" in
importJobTestImpl(importFiletype = "pfb")
}
"should send rawlsjson to cWDS" in {
"should send rawlsjson to cWDS" in
importJobTestImpl(importFiletype = "rawlsjson")
}

def importJobTestImpl(importFiletype: String) = {
// set up mocks
Expand Down
Loading

0 comments on commit 4466555

Please sign in to comment.