From df475c86c5264aa8cc1af79abc0c03e5aa56465b Mon Sep 17 00:00:00 2001 From: broadbot Date: Mon, 27 Jan 2025 12:04:10 +0000 Subject: [PATCH 1/7] CORE-69: Update billing-profile-manager-client from 0.1.600-SNAPSHOT to 0.1.602-SNAPSHOT --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 85ce5935e8..6f35af6a5f 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -130,7 +130,7 @@ object Dependencies { val workspaceManager = clientLibExclusions("bio.terra" % "workspace-manager-client" % "0.254.1172-SNAPSHOT") val dataRepo = clientLibExclusions("bio.terra" % "datarepo-jakarta-client" % "1.593.0-SNAPSHOT") val resourceBufferService = clientLibExclusions("bio.terra" % "terra-resource-buffer-client" % "0.198.42-SNAPSHOT") - val billingProfileManager = clientLibExclusions("bio.terra" % "billing-profile-manager-client" % "0.1.600-SNAPSHOT") + val billingProfileManager = clientLibExclusions("bio.terra" % "billing-profile-manager-client" % "0.1.602-SNAPSHOT") val terraCommonLib = tclExclusions(clientLibExclusions("bio.terra" % "terra-common-lib" % "0.1.23-SNAPSHOT" classifier "plain")) val sam: ModuleID = clientLibExclusions("org.broadinstitute.dsde.workbench" %% "sam-client" % "v0.0.347") val leonardo: ModuleID = "org.broadinstitute.dsde.workbench" % "leonardo-client_2.13" % "1.3.6-2e87300" From 0bb1e1fa3eb1323142431ee9d8765b3ec1dc770f Mon Sep 17 00:00:00 2001 From: broadbot Date: Mon, 27 Jan 2025 12:04:13 +0000 Subject: [PATCH 2/7] CORE-69: Update mysql-connector-j from 9.1.0 to 9.2.0 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 6f35af6a5f..21331b80c3 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -78,7 +78,7 @@ object Dependencies { val apacheCommonsIO: ModuleID = "commons-io" % "commons-io" % "2.18.0" val antlrParser: ModuleID = "org.antlr" % "antlr4-runtime" % "4.13.2" // protobuf is only need to use the MySQL X DevAPI which we don't. exclude it to avoid interference with Google client libraries - val mysqlConnector: ModuleID = "com.mysql" % "mysql-connector-j" % "9.1.0" exclude("com.google.protobuf", "protobuf-java") + val mysqlConnector: ModuleID = "com.mysql" % "mysql-connector-j" % "9.2.0" exclude("com.google.protobuf", "protobuf-java") val liquibaseCore: ModuleID = "org.liquibase" % "liquibase-core" % "4.31.0" val jakartaWsRs: ModuleID = "jakarta.ws.rs" % "jakarta.ws.rs-api" % "4.0.0" val jerseyJnhConnector: ModuleID = "org.glassfish.jersey.connectors" % "jersey-jnh-connector" % "3.1.10" From cdf088b780d05274bb086521c831621bef74faae Mon Sep 17 00:00:00 2001 From: broadbot Date: Mon, 27 Jan 2025 12:04:15 +0000 Subject: [PATCH 3/7] CORE-69: Update sentry-logback from 7.20.0 to 7.20.1 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 21331b80c3..b13f04a756 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -64,7 +64,7 @@ object Dependencies { val jacksonCore: ModuleID = "com.fasterxml.jackson.core" % "jackson-core" % "2.18.2" val jodaTime: ModuleID = "joda-time" % "joda-time" % "2.13.0" val typesafeConfig: ModuleID = "com.typesafe" % "config" % "1.4.3" - val sentryLogback: ModuleID = "io.sentry" % "sentry-logback" % "7.20.0" + val sentryLogback: ModuleID = "io.sentry" % "sentry-logback" % "7.20.1" val webjarsLocator: ModuleID = "org.webjars" % "webjars-locator" % "0.52" val commonsJEXL: ModuleID = "org.apache.commons" % "commons-jexl" % "2.1.1" val cats: ModuleID = "org.typelevel" %% "cats-core" % "2.12.0" From 3175dc2eb18f5a9063206d7f9f9aab397f843930 Mon Sep 17 00:00:00 2001 From: broadbot Date: Mon, 27 Jan 2025 12:04:16 +0000 Subject: [PATCH 4/7] CORE-69: Update scalafmt-core from 3.8.5 to 3.8.6 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 0d946b7d71..b314453f39 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = 3.8.5 +version = 3.8.6 align = none align.openParenCallSite = true align.openParenDefnSite = true From 00ab6a6678505b83488ace234e7b98c855b0e19a Mon Sep 17 00:00:00 2001 From: broadbot Date: Mon, 27 Jan 2025 12:05:03 +0000 Subject: [PATCH 5/7] Reformat with scalafmt 3.8.6 Executed command: scalafmt --non-interactive --- .../HttpExecutionServiceDAOSpec.scala | 21 ++-- ...aRepoEntityProviderQueryEntitiesSpec.scala | 3 +- .../datarepo/DataRepoEntityProviderSpec.scala | 3 +- .../rawls/jobexec/SubmissionMonitorSpec.scala | 3 +- .../dsde/rawls/jobexec/SubmissionSpec.scala | 12 +- ...loneWorkspaceFileTransferMonitorSpec.scala | 9 +- .../rawls/monitor/HealthMonitorSpec.scala | 3 +- .../SubmissionValidationSpec.scala | 6 +- .../dsde/rawls/user/UserServiceSpec.scala | 111 ++++++------------ .../webservice/EntityApiServiceSpec.scala | 26 ++-- .../MethodConfigApiServiceSpec.scala | 21 ++-- .../webservice/RawlsApiServiceSpec.scala | 16 ++- .../webservice/SubmissionApiServiceSpec.scala | 15 +-- .../webservice/WorkspaceApiServiceSpec.scala | 15 +-- .../workspace/WorkspaceServiceSpec.scala | 3 +- .../workspace/WorkspaceServiceUnitTests.scala | 15 +-- .../rawls/google/GoogleUtilitiesSpec.scala | 6 +- .../HttpGooglePubSubDAOSpec.scala | 3 +- .../metrics/GoogleInstrumentedSpec.scala | 6 +- .../dsde/rawls/model/WorkspaceModelSpec.scala | 3 +- 20 files changed, 105 insertions(+), 195 deletions(-) diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/HttpExecutionServiceDAOSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/HttpExecutionServiceDAOSpec.scala index 3f66e31062..949a8bff7a 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/HttpExecutionServiceDAOSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/HttpExecutionServiceDAOSpec.scala @@ -63,7 +63,7 @@ class HttpExecutionServiceDAOSpec super.afterAll() } - "HttpExecutionServiceDAO" should "submit workflows" in { + "HttpExecutionServiceDAO" should "submit workflows" in withStatsD { val submitResult = test.submitWorkflows(WdlSource("wdl"), Seq("input1", "input2"), None, None, None, userInfo).futureValue @@ -83,9 +83,8 @@ class HttpExecutionServiceDAOSpec Option(Subsystems.Cromwell) )) } - } - it should "query for status" in { + it should "query for status" in withStatsD { val result = test.status("foo", userInfo).futureValue result.status shouldBe "Running" @@ -97,9 +96,8 @@ class HttpExecutionServiceDAOSpec Option(Subsystems.Cromwell) )) } - } - it should "query for metadata" in { + it should "query for metadata" in withStatsD { val result = test.callLevelMetadata("8afafe21-2b70-4180-a565-748cb573e10c", MetadataParams(), userInfo).futureValue @@ -112,9 +110,8 @@ class HttpExecutionServiceDAOSpec Option(Subsystems.Cromwell) )) } - } - it should "query for outputs" in { + it should "query for outputs" in withStatsD { val result = test.outputs("69d1d92f-3895-4a7b-880a-82535e9a096e", userInfo).futureValue result.id shouldBe "this_workflow_exists" @@ -127,9 +124,8 @@ class HttpExecutionServiceDAOSpec Option(Subsystems.Cromwell) )) } - } - it should "query for logs" in { + it should "query for logs" in withStatsD { val result = test.logs("8afafe21-2b70-4180-a565-748cb573e10c", userInfo).futureValue result.id shouldBe "8afafe21-2b70-4180-a565-748cb573e10c" @@ -142,9 +138,8 @@ class HttpExecutionServiceDAOSpec Option(Subsystems.Cromwell) )) } - } - it should "abort workflows" in { + it should "abort workflows" in withStatsD { val result = test.abort("workflowA", userInfo).futureValue result.isSuccess shouldBe true @@ -158,9 +153,8 @@ class HttpExecutionServiceDAOSpec Option(Subsystems.Cromwell) )) } - } - it should "get labels and patch labels" in { + it should "get labels and patch labels" in withStatsD { val labels = Map("key1" -> "val1", "key2" -> "val2") @@ -177,7 +171,6 @@ class HttpExecutionServiceDAOSpec expectedHttpRequestMetrics("patch", "api.workflows.v1.redacted.labels", 200, 1, Option(Subsystems.Cromwell)) ) } - } it should "get the version" in withStatsD { diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderQueryEntitiesSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderQueryEntitiesSpec.scala index 9bc79e56f6..6d6549805f 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderQueryEntitiesSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderQueryEntitiesSpec.scala @@ -236,11 +236,10 @@ class DataRepoEntityProviderQueryEntitiesSpec assertResult("term filtering not supported by this provider.")(ex.getMessage) } - ignore should "fail if user is a workspace Reader but did not specify a billing project (canCompute?)" in { + ignore should "fail if user is a workspace Reader but did not specify a billing project (canCompute?)" in // we haven't implemented the runtime logic for this because we don't have PO input, // so we don't know exactly what to unit test fail("not implemented in runtime code yet") - } it should "fail if snapshot has no tables in data repo" in { val provider = createTestProvider(snapshotModel = createSnapshotModel(List.empty[TableModel])) diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderSpec.scala index 001a9932b3..99d4ff7537 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderSpec.scala @@ -182,11 +182,10 @@ class DataRepoEntityProviderSpec } } - ignore should "fail if user is a workspace Reader but did not specify a billing project (canCompute?)" in { + ignore should "fail if user is a workspace Reader but did not specify a billing project (canCompute?)" in // we haven't implemented the runtime logic for this because we don't have PO input, // so we don't know exactly what to unit test fail("not implemented in runtime code yet") - } it should "fail if snapshot table not found in data repo's response" in { val provider = createTestProvider() // default behavior returns three rows diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionMonitorSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionMonitorSpec.scala index 153db05dd3..71c37211ad 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionMonitorSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionMonitorSpec.scala @@ -1735,7 +1735,7 @@ class SubmissionMonitorSpec(_system: ActorSystem) } } - it should "handleStatusResponses and fail workflows that have invalid output expressions" in { + it should "handleStatusResponses and fail workflows that have invalid output expressions" in withDefaultTestDatabase { dataSource: SlickDataSource => runAndWait { withWorkspaceContext(testData.workspace) { context => @@ -1797,7 +1797,6 @@ class SubmissionMonitorSpec(_system: ActorSystem) ).get.status } } - } it should "fail workflows that exceed the configured workspace attribute maximum" in withDefaultTestDatabase { dataSource: SlickDataSource => diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionSpec.scala index 89011aaf9f..3bd132e851 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionSpec.scala @@ -1100,7 +1100,7 @@ class SubmissionSpec(_system: ActorSystem) ) } - it should "set the correct root path for a submission given the SeparateSubmissionFinalOutputsSetting is true" in { + it should "set the correct root path for a submission given the SeparateSubmissionFinalOutputsSetting is true" in workspaceSettingSubmissionTest(SeparateSubmissionFinalOutputs = true) { submissionsService => val submissionRq = SubmissionRequest( methodConfigurationNamespace = "dsde", @@ -1119,9 +1119,8 @@ class SubmissionSpec(_system: ActorSystem) submissionData.submissionRoot should include("intermediates") } - } - it should "set the correct root path for a submission given the SeparateSubmissionFinalOutputsSetting is false" in { + it should "set the correct root path for a submission given the SeparateSubmissionFinalOutputsSetting is false" in workspaceSettingSubmissionTest(SeparateSubmissionFinalOutputs = false) { submissionsService => val submissionRq = SubmissionRequest( methodConfigurationNamespace = "dsde", @@ -1140,7 +1139,6 @@ class SubmissionSpec(_system: ActorSystem) submissionData.submissionRoot should not include "intermediates" } - } it should "create data repo submission" in { val tableData = List.fill(3)(UUID.randomUUID().toString).map(rowId => rowId -> s"value $rowId").toMap @@ -1539,7 +1537,7 @@ class SubmissionSpec(_system: ActorSystem) } } - it should "report error when data reference exists with entity name" in { + it should "report error when data reference exists with entity name" in dataRepoSubmissionTest(Map.empty) { (submissionsService, methodConfig, snapshotId) => val submissionRq = SubmissionRequest( methodConfigurationNamespace = methodConfig.namespace, @@ -1558,9 +1556,8 @@ class SubmissionSpec(_system: ActorSystem) ex.errorReport.causes should have length 1 ex.errorReport.causes.head.message shouldBe "Your method config defines a data reference and an entity name. Running on a submission on a single entity in a data reference is not yet supported." } - } - it should "report error when data reference points to unknown snapshot" in { + it should "report error when data reference points to unknown snapshot" in dataRepoSubmissionTest(Map.empty) { (submissionsService, methodConfig, snapshotId) => runAndWait( methodConfigurationQuery.upsert(minimalTestData.workspace, @@ -1584,7 +1581,6 @@ class SubmissionSpec(_system: ActorSystem) ex.errorReport.statusCode shouldBe Option(StatusCodes.NotFound) ex.errorReport.message shouldBe "Reference name unknown does not exist in workspace myNamespace/myWorkspace." } - } it should "report error when root entity type does not refer to a table in the snapshot" in dataRepoSubmissionTest(Map.empty) { (submissionsService, methodConfig, snapshotId) => diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/CloneWorkspaceFileTransferMonitorSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/CloneWorkspaceFileTransferMonitorSpec.scala index 2befe0f055..9574fd503e 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/CloneWorkspaceFileTransferMonitorSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/CloneWorkspaceFileTransferMonitorSpec.scala @@ -52,7 +52,7 @@ class CloneWorkspaceFileTransferMonitorSpec(_system: ActorSystem) ) = system.actorOf(CloneWorkspaceFileTransferMonitor.props(dataSource, mockGcsDAO, 1 second, 1 second)) - "CloneWorkspaceFileTransferMonitor" should "eventually copy files from the source bucket to the destination bucket" in { + "CloneWorkspaceFileTransferMonitor" should "eventually copy files from the source bucket to the destination bucket" in withEmptyTestDatabase { dataSource: SlickDataSource => val billingProject = RawlsBillingProject(defaultBillingProjectName, CreationStatuses.Ready, @@ -148,9 +148,8 @@ class CloneWorkspaceFileTransferMonitorSpec(_system: ActorSystem) system.stop(actor) } - } - it should "continue trying to transfer files when receiving 403s from Google while listing objects" in { + it should "continue trying to transfer files when receiving 403s from Google while listing objects" in withEmptyTestDatabase { dataSource: SlickDataSource => val billingProject = RawlsBillingProject(defaultBillingProjectName, CreationStatuses.Ready, @@ -237,9 +236,8 @@ class CloneWorkspaceFileTransferMonitorSpec(_system: ActorSystem) system.stop(actor) } - } - it should "continue trying to transfer files when receiving 403s from Google while copying objects" in { + it should "continue trying to transfer files when receiving 403s from Google while copying objects" in withEmptyTestDatabase { dataSource: SlickDataSource => val billingProject = RawlsBillingProject(defaultBillingProjectName, CreationStatuses.Ready, @@ -338,7 +336,6 @@ class CloneWorkspaceFileTransferMonitorSpec(_system: ActorSystem) system.stop(actor) } - } it should "continue trying to copy the files until all copies succeed" in { withEmptyTestDatabase { dataSource: SlickDataSource => diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/HealthMonitorSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/HealthMonitorSpec.scala index 2a8a1dcc88..34d97ffd9a 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/HealthMonitorSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/HealthMonitorSpec.scala @@ -58,9 +58,8 @@ class HealthMonitorSpec sub -> SubsystemStatus(false, Option(List(s"""{"$sub": "is unhappy"}"""))) }).toMap - "HealthMonitor" should "start with unknown status for all subsystems" in { + "HealthMonitor" should "start with unknown status for all subsystems" in checkCurrentStatus(newHealthMonitorActor(), false, unknowns = AllSubsystems) - } it should "return ok status for all subsystems" in { val actor = newHealthMonitorActor() diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/submissions/SubmissionValidationSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/submissions/SubmissionValidationSpec.scala index cad575a9db..176bf29ef9 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/submissions/SubmissionValidationSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/submissions/SubmissionValidationSpec.scala @@ -43,7 +43,7 @@ class SubmissionValidationSpec extends AnyFlatSpec with Matchers with TableDrive ) ) - it should "validate perWorkflowCostCap" in { + it should "validate perWorkflowCostCap" in forAll(perWorkflowCostCapValidations) { (_, value, expectedErrors) => val submission = SubmissionRequest("name", "namespace", None, None, None, false, false, perWorkflowCostCap = value) @@ -62,9 +62,8 @@ class SubmissionValidationSpec extends AnyFlatSpec with Matchers with TableDrive } } } - } - it should "validate workflowFailureMode" in { + it should "validate workflowFailureMode" in forAll( Table( ("WorkflowFailureMode value", "valid value"), @@ -95,7 +94,6 @@ class SubmissionValidationSpec extends AnyFlatSpec with Matchers with TableDrive errors.head.message should include(workflowFailureMode.getOrElse("None")) } } - } behavior of "entity name and type validation" diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/user/UserServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/user/UserServiceSpec.scala index 6178fe8319..6b11a556ca 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/user/UserServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/user/UserServiceSpec.scala @@ -120,7 +120,7 @@ class UserServiceSpec ) // 204 when project exists without perimeter and user is owner of project and has right permissions on service-perimeter - "UserService" should "add a service perimeter field for an existing project when user has correct permissions" in { + "UserService" should "add a service perimeter field for an existing project when user has correct permissions" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject runAndWait(rawlsBillingProjectQuery.create(project)) @@ -151,10 +151,9 @@ class UserServiceSpec updatedProject.servicePerimeter shouldBe Option(defaultServicePerimeterName) } - } // 204 when all of the above even if project doesn't have a google project number - it should "add a service perimeter field and update the status for an existing project when user has correct permissions even if there isn't a project number already" in { + it should "add a service perimeter field and update the status for an existing project when user has correct permissions even if there isn't a project number already" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject.copy(googleProjectNumber = None) @@ -198,10 +197,9 @@ class UserServiceSpec updatedProject.servicePerimeter shouldBe Option(defaultServicePerimeterName) updatedProject.googleProjectNumber shouldBe Option(googleProjectNumber) } - } // 400 when project has a perimeter already - it should "fail with a 400 when the project already has a perimeter" in { + it should "fail with a 400 when the project already has a perimeter" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject.copy(servicePerimeter = Option(ServicePerimeterName("accessPolicies/123/servicePerimeters/other_perimeter")) @@ -217,10 +215,9 @@ class UserServiceSpec StatusCodes.BadRequest ) } - } // 400 when project is not 'Ready' - it should "fail with a 400 when the project's status is not 'Ready'" in { + it should "fail with a 400 when the project's status is not 'Ready'" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject.copy(status = CreationStatuses.Creating) runAndWait(rawlsBillingProjectQuery.create(project)) @@ -234,10 +231,9 @@ class UserServiceSpec StatusCodes.BadRequest ) } - } // 403 when user isn't owner of project or project dne - it should "fail with a 403 when Sam says the user does not have permission on the billing project" in { + it should "fail with a 403 when Sam says the user does not have permission on the billing project" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject runAndWait(rawlsBillingProjectQuery.create(project)) @@ -267,10 +263,9 @@ class UserServiceSpec StatusCodes.Forbidden ) } - } // 404 when user doesn't have permissions on service-perimeter or s-p dne - it should "fail with a 404 when Sam says the user does not have permission on the service perimeter" in { + it should "fail with a 404 when Sam says the user does not have permission on the service perimeter" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject runAndWait(rawlsBillingProjectQuery.create(project)) @@ -298,10 +293,9 @@ class UserServiceSpec assert(actual.isInstanceOf[RawlsExceptionWithErrorReport]) actual.asInstanceOf[RawlsExceptionWithErrorReport].errorReport.statusCode shouldEqual Option(StatusCodes.NotFound) } - } // 200 when billing project is deleted - it should "Successfully to delete a billing project" in { + it should "Successfully to delete a billing project" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject val userIdInfo = UserIdInfo(userInfo.userSubjectId.value, userInfo.userEmail.value, Option("googleSubId")) @@ -349,9 +343,8 @@ class UserServiceSpec runAndWait(rawlsBillingProjectQuery.load(defaultBillingProjectName)) shouldBe empty actual shouldEqual () } - } - it should "Successfully to delete a billing project when the google project does not exist on GCP" in { + it should "Successfully to delete a billing project when the google project does not exist on GCP" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject val userIdInfo = UserIdInfo(userInfo.userSubjectId.value, userInfo.userEmail.value, Option("googleSubId")) @@ -399,9 +392,8 @@ class UserServiceSpec runAndWait(rawlsBillingProjectQuery.load(defaultBillingProjectName)) shouldBe empty actual shouldEqual () } - } - it should "fail with a 400 when workspace exists in this billing project to be deleted" in { + it should "fail with a 400 when workspace exists in this billing project to be deleted" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject // A workspace with the which namespaceName equals to defaultBillingProject's billing project name. @@ -436,9 +428,8 @@ class UserServiceSpec } actual.errorReport.statusCode shouldEqual Option(StatusCodes.BadRequest) } - } - it should "fail with a 403 when Sam says the user does not have permission to delete billing project" in { + it should "fail with a 403 when Sam says the user does not have permission to delete billing project" in withEmptyTestDatabase { dataSource: SlickDataSource => val project = defaultBillingProject runAndWait(rawlsBillingProjectQuery.create(project)) @@ -459,9 +450,8 @@ class UserServiceSpec } actual.errorReport.statusCode shouldEqual Option(StatusCodes.Forbidden) } - } - it should "set the spend configuration of a billing project when the user has permission" in { + it should "set the spend configuration of a billing project when the user has permission" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val spendReportDatasetName = BigQueryDatasetName("test_dataset") @@ -495,9 +485,8 @@ class UserServiceSpec s"gcp_billing_export_v1_${billingProject.billingAccount.get.value.stripPrefix("billingAccounts/").replace("-", "_")}" spendReportConfigInDb.head shouldEqual (Some(spendReportDatasetName.value), Some(spendReportTableName)) } - } - it should "not set the spend configuration of a billing project when the user doesn't have permission" in { + it should "not set the spend configuration of a billing project when the user doesn't have permission" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val spendReportDatasetName = BigQueryDatasetName("test_dataset") @@ -535,9 +524,8 @@ class UserServiceSpec // assert that no change was made to the spend configuration spendReportConfigInDb.head shouldEqual (None, None) } - } - it should "clear the spend configuration of a billing project" in { + it should "clear the spend configuration of a billing project" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val spendReportDatasetName = BigQueryDatasetName("test_dataset") @@ -566,9 +554,8 @@ class UserServiceSpec spendReportConfigInDb.head shouldEqual (None, None) } - } - it should "not clear the spend configuration of a billing project when the user doesn't have permission" in { + it should "not clear the spend configuration of a billing project when the user doesn't have permission" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val spendReportDatasetName = BigQueryDatasetName("should_not_clear_dataset") @@ -613,9 +600,8 @@ class UserServiceSpec // assert that no change was made to the spend configuration spendReportConfigInDb.head shouldEqual (Some(spendReportDatasetName.value), Some(spendReportTableName.value)) } - } - it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the dataset does not exist or can't be accessed" in { + it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the dataset does not exist or can't be accessed" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val spendReportDatasetName = BigQueryDatasetName("dataset_does_not_exist") @@ -642,9 +628,8 @@ class UserServiceSpec actual.errorReport.statusCode.get shouldEqual StatusCodes.BadRequest } - } - it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the table does not exist or can't be accessed" in { + it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the table does not exist or can't be accessed" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = RawlsBillingProject(RawlsBillingProjectName("project_without_table"), CreationStatuses.Ready, None, None) @@ -674,9 +659,8 @@ class UserServiceSpec actual.errorReport.statusCode.get shouldEqual StatusCodes.BadRequest } - } - it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the billing project does not have a billing account associated with it" in { + it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the billing project does not have a billing account associated with it" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = RawlsBillingProject(RawlsBillingProjectName("project_without_billing_account"), CreationStatuses.Ready, @@ -709,9 +693,8 @@ class UserServiceSpec actual.errorReport.statusCode.get shouldEqual StatusCodes.BadRequest } - } - it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the dataset has an invalid name" in { + it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the dataset has an invalid name" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val spendReportDatasetName = BigQueryDatasetName("test-dataset") @@ -738,9 +721,8 @@ class UserServiceSpec actual.errorReport.statusCode.get shouldEqual StatusCodes.BadRequest } - } - it should "update the billing account for a billing project" in { + it should "update the billing account for a billing project" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val billingAccountName = RawlsBillingAccountName("billingAccounts/111111-111111-111111") @@ -806,9 +788,8 @@ class UserServiceSpec any() ) } - } - it should "remove the billing account for a billing project" in { + it should "remove the billing account for a billing project" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject @@ -854,9 +835,8 @@ class UserServiceSpec any() ) } - } - it should "not update the billing account for a billing project if the user does not have access to the billing project" in { + it should "not update the billing account for a billing project if the user does not have access to the billing project" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val billingAccountName = RawlsBillingAccountName("billingAccounts/111111-111111-111111") @@ -892,9 +872,8 @@ class UserServiceSpec .getOrElse(fail("project not found")) .billingAccount shouldEqual billingProject.billingAccount } - } - it should "not update the billing account for a billing project if the user does not have access to the billing account" in { + it should "not update the billing account for a billing project if the user does not have access to the billing account" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val billingAccountName = RawlsBillingAccountName("billingAccounts/111111-111111-111111") @@ -930,9 +909,8 @@ class UserServiceSpec .getOrElse(fail("project not found")) .billingAccount shouldEqual billingProject.billingAccount } - } - it should "not remove the billing account for a billing project if the user does not have access to the billing project" in { + it should "not remove the billing account for a billing project if the user does not have access to the billing project" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val billingAccountName = RawlsBillingAccountName("billingAccounts/111111-111111-111111") @@ -963,9 +941,8 @@ class UserServiceSpec .getOrElse(fail("project not found")) .billingAccount shouldEqual billingProject.billingAccount } - } - it should "throw a RawlsExceptionWithErrorReport when updating the billing account for a billing project and the billing account name is not valid" in { + it should "throw a RawlsExceptionWithErrorReport when updating the billing account for a billing project and the billing account name is not valid" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val billingAccountName = RawlsBillingAccountName("INVALID") @@ -1001,9 +978,8 @@ class UserServiceSpec .getOrElse(fail("project not found")) .billingAccount shouldEqual billingProject.billingAccount } - } - it should "not call BPM when updating or removing a billing account if the billing project has no billing profile" in { + it should "not call BPM when updating or removing a billing account if the billing project has no billing profile" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject.copy(projectName = RawlsBillingProjectName("noProfile"), billingProfileId = None) @@ -1044,9 +1020,8 @@ class UserServiceSpec verifyNoInteractions(mockBpmDAO) } - } - it should "not throw if BPM errors while updating the billing profile" in { + it should "not throw if BPM errors while updating the billing profile" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val billingAccountName = RawlsBillingAccountName("billingAccounts/111111-111111-111111") @@ -1103,9 +1078,8 @@ class UserServiceSpec any() ) } - } - it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the dataset google project has an invalid name" in { + it should "throw a RawlsExceptionWithErrorReport when setting the spend configuration if the dataset google project has an invalid name" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val spendReportDatasetName = BigQueryDatasetName("test-dataset") @@ -1132,9 +1106,8 @@ class UserServiceSpec actual.errorReport.statusCode.get shouldEqual StatusCodes.BadRequest } - } - it should "get the spend report configuration of a billing project when the user has permission" in { + it should "get the spend report configuration of a billing project when the user has permission" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject val spendReportDatasetName = BigQueryDatasetName("test_dataset") @@ -1169,9 +1142,8 @@ class UserServiceSpec result shouldEqual Some(spendReportConfiguration) } - } - it should "return None when the user calls getSpendReportConfiguration but it isn't configured" in { + it should "return None when the user calls getSpendReportConfiguration but it isn't configured" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject @@ -1198,9 +1170,8 @@ class UserServiceSpec result shouldEqual None } - } - it should "throw a RawlsExceptionWithErrorReport when the user does not have permission to get the spend report configuration" in { + it should "throw a RawlsExceptionWithErrorReport when the user does not have permission to get the spend report configuration" in withMinimalTestDatabase { dataSource: SlickDataSource => val billingProject = minimalTestData.billingProject @@ -1221,9 +1192,8 @@ class UserServiceSpec actual.errorReport.statusCode.get shouldEqual StatusCodes.Forbidden } - } - it should "throw a RawlsExceptionWithErrorReport getting the spend report configuration for a project does not exist" in { + it should "throw a RawlsExceptionWithErrorReport getting the spend report configuration for a project does not exist" in withMinimalTestDatabase { dataSource: SlickDataSource => val projectName = RawlsBillingProjectName("fake-project") @@ -1244,7 +1214,6 @@ class UserServiceSpec actual.errorReport.statusCode.get shouldEqual StatusCodes.NotFound } - } behavior of "getBillingProject" @@ -1620,7 +1589,7 @@ class UserServiceSpec behavior of "addUserToBillingProjectV2" - it should "update billing profile record when a user is added to a billing project" in { + it should "update billing profile record when a user is added to a billing project" in withMinimalTestDatabase { dataSource => val billingProfileId = UUID.randomUUID() val ownerProject = billingProjectFromName(UUID.randomUUID().toString, billingProfileId) @@ -1668,9 +1637,8 @@ class UserServiceSpec testContext ) } - } - it should "update billing profile record when an owner is added to a billing project" in { + it should "update billing profile record when an owner is added to a billing project" in withMinimalTestDatabase { dataSource => val billingProfileId = UUID.randomUUID() val ownerProject = billingProjectFromName(UUID.randomUUID().toString, billingProfileId) @@ -1718,9 +1686,8 @@ class UserServiceSpec testContext ) } - } - it should "not update Sam permissions if billing profile member addition fails" in { + it should "not update Sam permissions if billing profile member addition fails" in withMinimalTestDatabase { dataSource => val billingProfileId = UUID.randomUUID() val ownerProject = billingProjectFromName(UUID.randomUUID().toString, billingProfileId) @@ -1763,11 +1730,10 @@ class UserServiceSpec testContext ) } - } behavior of "removeUserFromBillingProjectV2" - it should "update billing profile record when a user is removed from a billing project" in { + it should "update billing profile record when a user is removed from a billing project" in withMinimalTestDatabase { dataSource => val billingProfileId = UUID.randomUUID() val ownerProject = billingProjectFromName(UUID.randomUUID().toString, billingProfileId) @@ -1815,9 +1781,8 @@ class UserServiceSpec testContext ) } - } - it should "update billing profile record when an owner is removed from a billing project" in { + it should "update billing profile record when an owner is removed from a billing project" in withMinimalTestDatabase { dataSource => val billingProfileId = UUID.randomUUID() val ownerProject = billingProjectFromName(UUID.randomUUID().toString, billingProfileId) @@ -1865,9 +1830,8 @@ class UserServiceSpec testContext ) } - } - it should "update billing profile record when an owner removes themself from a project" in { + it should "update billing profile record when an owner removes themself from a project" in withMinimalTestDatabase { dataSource => val billingProfileId = UUID.randomUUID() val ownerProject = billingProjectFromName(UUID.randomUUID().toString, billingProfileId) @@ -1913,7 +1877,6 @@ class UserServiceSpec testContext ) } - } it should "not update Sam permissions if billing profile member deletion fails" in withMinimalTestDatabase { dataSource => diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/EntityApiServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/EntityApiServiceSpec.scala index 2379de8e7d..8cee0ea0a2 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/EntityApiServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/EntityApiServiceSpec.scala @@ -3448,17 +3448,16 @@ class EntityApiServiceSpec extends ApiServiceSpec { // filter-by-name and filter-by-column tests. All of these tests are read-only and use the same set of exemplar data, // so we only create that data once: withPaginationTestDataApiServices { services => - it should "return 400 when specifying both filterTerms and columnFilter" in { + it should "return 400 when specifying both filterTerms and columnFilter" in Get( s"${paginationTestData.workspace.path}/entityQuery/${paginationTestData.entityType}?filterTerms=foo&columnFilter=bar%3Dbaz" ) ~> - sealRoute(services.entityRoutes()) ~> - check { - assertResult(StatusCodes.BadRequest) { - status - } + sealRoute(services.entityRoutes()) ~> + check { + assertResult(StatusCodes.BadRequest) { + status } - } + } it should "return correct result when filtering by name on entity query" in { val entityNameFilter = "entity_99" @@ -3814,17 +3813,16 @@ class EntityApiServiceSpec extends ApiServiceSpec { } } - it should "return 400 when column filter is incomplete" in { + it should "return 400 when column filter is incomplete" in Get( s"${paginationTestData.workspace.path}/entityQuery/${paginationTestData.entityType}?columnFilter=incorrectFilter" ) ~> - sealRoute(services.entityRoutes()) ~> - check { - assertResult(StatusCodes.BadRequest) { - status - } + sealRoute(services.entityRoutes()) ~> + check { + assertResult(StatusCodes.BadRequest) { + status } - } + } it should "return 400 when column filter is invalid" in Get( diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/MethodConfigApiServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/MethodConfigApiServiceSpec.scala index ac8c7f530d..75dc76dfbb 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/MethodConfigApiServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/MethodConfigApiServiceSpec.scala @@ -742,9 +742,8 @@ class MethodConfigApiServiceSpec extends ApiServiceSpec with TestDriverComponent } } - it should "return 200 on put method configuration" in { + it should "return 200 on put method configuration" in check200AddMC(Put) - } it should "return 200 on post method configuration" in check200AddMC(Post) @@ -778,9 +777,8 @@ class MethodConfigApiServiceSpec extends ApiServiceSpec with TestDriverComponent } } - it should "update the workspace last modified date on put method configuration" in { + it should "update the workspace last modified date on put method configuration" in checkLastModified(Put) - } it should "update the workspace last modified date on post method configuration" in checkLastModified(Post) @@ -827,9 +825,8 @@ class MethodConfigApiServiceSpec extends ApiServiceSpec with TestDriverComponent } } - it should "validate attribute syntax in put method configuration" in { + it should "validate attribute syntax in put method configuration" in checkValidAttributeSyntax(Put) - } it should "validate attribute syntax in post method configuration" in checkValidAttributeSyntax(Post) @@ -853,9 +850,8 @@ class MethodConfigApiServiceSpec extends ApiServiceSpec with TestDriverComponent } } - it should "not allow library attributes in outputs for put method configuration by curator" in { + it should "not allow library attributes in outputs for put method configuration by curator" in checkNoLibraryAttributesInOutputsByCurator(Put) - } it should "not allow library attributes in outputs for post method configuration by curator" in checkNoLibraryAttributesInOutputsByCurator(Post) @@ -881,13 +877,11 @@ class MethodConfigApiServiceSpec extends ApiServiceSpec with TestDriverComponent } } - it should "not allow library attributes in outputs for put method configuration by non-curator" in { + it should "not allow library attributes in outputs for put method configuration by non-curator" in checkNoLibraryAttributesInOutputsByNonCurator(Put) - } - it should "not allow library attributes in outputs for post method configuration by non-curator" in { + it should "not allow library attributes in outputs for post method configuration by non-curator" in checkNoLibraryAttributesInOutputsByNonCurator(Post) - } it should "return 400 on put method configuration if the location differs between URI and JSON body" in withTestDataApiServices { services => @@ -960,7 +954,7 @@ class MethodConfigApiServiceSpec extends ApiServiceSpec with TestDriverComponent } } - it should "get syntax validation information when using a reserved output attribute" in { + it should "get syntax validation information when using a reserved output attribute" in withTestDataApiServices { services => val entityType = "some_type_of_entity" @@ -1007,7 +1001,6 @@ class MethodConfigApiServiceSpec extends ApiServiceSpec with TestDriverComponent assertSameElements(expectedFailureOutputs, validated.invalidOutputs) } } - } it should "return 404 on update method configuration" in withTestDataApiServices { services => Post(s"${testData.workspace.path}/methodconfigs/update}", httpJson(testData.agoraMethodConfig)) ~> diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/RawlsApiServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/RawlsApiServiceSpec.scala index d1cfdaf70c..73662a4f90 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/RawlsApiServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/RawlsApiServiceSpec.scala @@ -35,7 +35,7 @@ class RawlsApiServiceSpec extends ApiServiceSpec with VersionApiService { ) override val appVersion = ApplicationVersion("githash", "buildnumber", "version") - "RootRawlsApiService" should "get a version" in { + "RootRawlsApiService" should "get a version" in withStatsD { Get("/version") ~> sealRoute(captureRequestMetrics(traceRequests(_ => versionRoutes))) ~> @@ -47,16 +47,14 @@ class RawlsApiServiceSpec extends ApiServiceSpec with VersionApiService { val expected = expectedHttpRequestMetrics("get", "version", StatusCodes.OK.intValue, 1) assertSubsetOf(expected, capturedMetrics) } - } - it should "return the cromwell version" in { + it should "return the cromwell version" in Get("/version/executionEngine") ~> - sealRoute(versionRoutes) ~> - check { - assertResult(StatusCodes.OK)(status) - responseAs[ExecutionServiceVersion] - } - } + sealRoute(versionRoutes) ~> + check { + assertResult(StatusCodes.OK)(status) + responseAs[ExecutionServiceVersion] + } behavior of "ExceptionHandler" diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/SubmissionApiServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/SubmissionApiServiceSpec.scala index 9a7e84920d..ddf7cf2a63 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/SubmissionApiServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/SubmissionApiServiceSpec.scala @@ -1222,7 +1222,7 @@ class SubmissionApiServiceSpec extends ApiServiceSpec with TableDrivenPropertyCh } } - it should "return a parameter error if the memoryRetryMultiplier is invalid" in { + it should "return a parameter error if the memoryRetryMultiplier is invalid" in withTestDataApiServices { services => val workspaceName = testData.wsName val methodConfigurationName = MethodConfigurationName("no_input", "dsde", workspaceName) @@ -1244,7 +1244,6 @@ class SubmissionApiServiceSpec extends ApiServiceSpec with TableDrivenPropertyCh ) } } - } it should "return 400 Bad Request when deleteIntermediateOutputFiles is an integer" in withTestDataApiServices { services => @@ -1326,7 +1325,7 @@ class SubmissionApiServiceSpec extends ApiServiceSpec with TableDrivenPropertyCh } } - it should "return a parameter error if the userComment is invalid" in { + it should "return a parameter error if the userComment is invalid" in withTestDataApiServices { services => val workspaceName = testData.wsName val methodConfigurationName = MethodConfigurationName("no_input", "dsde", workspaceName) @@ -1348,9 +1347,8 @@ class SubmissionApiServiceSpec extends ApiServiceSpec with TableDrivenPropertyCh response should include("Invalid input userComment. Input may be a max of 1000 characters.") } } - } - it should "successfully update userComment after submission creation" in { + it should "successfully update userComment after submission creation" in withTestDataApiServices { services => val workspaceName = testData.wsName val methodConfigurationName = MethodConfigurationName("no_input", "dsde", workspaceName) @@ -1393,9 +1391,8 @@ class SubmissionApiServiceSpec extends ApiServiceSpec with TableDrivenPropertyCh } } } - } - it should "return the submission root when getting an individual submission" in { + it should "return the submission root when getting an individual submission" in withTestDataApiServices { services => val workspaceName = testData.wsName val methodConfigurationName = MethodConfigurationName("no_input", "dsde", workspaceName) @@ -1423,9 +1420,8 @@ class SubmissionApiServiceSpec extends ApiServiceSpec with TableDrivenPropertyCh } } } - } - it should "fail to update comment if submission doesn't exist" in { + it should "fail to update comment if submission doesn't exist" in withTestDataApiServices { services => val workspaceName = testData.wsName @@ -1444,7 +1440,6 @@ class SubmissionApiServiceSpec extends ApiServiceSpec with TableDrivenPropertyCh ) } } - } it should "return a 201 when a comment is updated" in { val wsName = testData.wsName diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/WorkspaceApiServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/WorkspaceApiServiceSpec.scala index c38c66c50a..30a6f715c2 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/WorkspaceApiServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/WorkspaceApiServiceSpec.scala @@ -138,7 +138,7 @@ class WorkspaceApiServiceSpec ("", None, None) ) - it should "call the workspace service to get tags with user query and limit" in { + it should "call the workspace service to get tags with user query and limit" in forAll(tagsTestParameters) { (queryString: String, userQuery: Option[String], limit: Option[Int]) => val workspaceService = mock[WorkspaceService] val mcWorkspaceService = mock[MultiCloudWorkspaceService] @@ -158,7 +158,6 @@ class WorkspaceApiServiceSpec } verify(workspaceService).getTags(userQuery, limit) } - } it should "get a workspace by id from the workspace service" in { val mcWorkspaceService = mock[MultiCloudWorkspaceService] @@ -300,7 +299,7 @@ class WorkspaceApiServiceSpec verify(workspaceService).updateWorkspace(workspaceName, update) } - it should "delete the workspace by name and namespace" in { + it should "delete the workspace by name and namespace" in forAll( Table( ("bucketResult", "message"), @@ -326,7 +325,6 @@ class WorkspaceApiServiceSpec } verify(mcWorkspaceService).deleteMultiCloudOrRawlsWorkspace(workspaceName, workspaceService) } - } it should "get accessInstructions by name and namespace" in { val mcWorkspaceService = mock[MultiCloudWorkspaceService] @@ -448,7 +446,7 @@ class WorkspaceApiServiceSpec verify(workspaceService).getACL(workspaceName) } - it should "update the workspace ACL for the patch operation" in { + it should "update the workspace ACL for the patch operation" in forAll( Table( ("queryString", "inviteMissingUsersValue"), @@ -488,7 +486,6 @@ class WorkspaceApiServiceSpec verify(workspaceService).updateACL(workspaceName, update, inviteMissingUsersValue) } - } it should "update the workspace library attributes" in { val mcWorkspaceService = mock[MultiCloudWorkspaceService] @@ -566,7 +563,7 @@ class WorkspaceApiServiceSpec verify(workspaceService).updateCatalog(workspaceName, update) } - it should "check the bucket read access" in { + it should "check the bucket read access" in forAll( Table[Option[RawlsException], StatusCode]( ("exception", "statusCode"), @@ -593,9 +590,8 @@ class WorkspaceApiServiceSpec } verify(workspaceService).checkWorkspaceCloudPermissions(workspaceName) } - } - it should "check the permission with checkIamActionWithLock on the workspace" in { + it should "check the permission with checkIamActionWithLock on the workspace" in forAll( Table( ("accessResult", "statusCode"), @@ -623,7 +619,6 @@ class WorkspaceApiServiceSpec verify(workspaceService).checkSamActionWithLock(workspaceName, SamWorkspaceActions.read) } - } it should "get the file transfers for the workspace" in { val mcWorkspaceService = mock[MultiCloudWorkspaceService] diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceServiceSpec.scala index dde28f5d5e..9f91ac7c79 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceServiceSpec.scala @@ -513,7 +513,7 @@ class WorkspaceServiceSpec } } - it should "pass sam read action check for a user with read access in a locked workspace" in { + it should "pass sam read action check for a user with read access in a locked workspace" in withTestDataServicesCustomSam { services => populateWorkspacePolicies(services, testData.workspaceNoSubmissions @@ -538,7 +538,6 @@ class WorkspaceServiceSpec rqComplete } } - } it should "fail sam write action check for a user with read access in an unlocked workspace" in withTestDataServicesCustomSamAndUser( testData.userReader diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceServiceUnitTests.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceServiceUnitTests.scala index 7c40fa5add..c8b3f0ac28 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceServiceUnitTests.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/workspace/WorkspaceServiceUnitTests.scala @@ -399,7 +399,7 @@ class WorkspaceServiceUnitTests verify(sam).userHasAction(SamResourceTypeNames.workspace, workspace.workspaceId, SamWorkspaceActions.compute, ctx) } - it should "return true for canShare if the user is a workspace or project owner" in { + it should "return true for canShare if the user is a workspace or project owner" in forAll(Table("role", "OWNER", "PROJECT_OWNER")) { (role: String) => val options = WorkspaceService.QueryOptions(Set("canShare"), WorkspaceAttributeSpecs(false)) val wsm = mock[WorkspaceManagerDAO] @@ -416,9 +416,8 @@ class WorkspaceServiceUnitTests result.canShare shouldBe Some(true) verify(sam).listUserRolesForResource(SamResourceTypeNames.workspace, workspace.workspaceId, ctx) } - } - it should "query sam for canShare if the user is not an owner" in { + it should "query sam for canShare if the user is not an owner" in forAll( Table( ("role", "samAnswer"), @@ -457,7 +456,6 @@ class WorkspaceServiceUnitTests ctx ) } - } it should "get the bucket options from gcs when requested" in { val options = WorkspaceService.QueryOptions(Set("bucketOptions"), WorkspaceAttributeSpecs(false)) @@ -554,7 +552,7 @@ class WorkspaceServiceUnitTests result shouldBe JsArray.empty } - it should "return workspaces the user has an access level role on" in { + it should "return workspaces the user has an access level role on" in forAll( Table( ("role", "hasAccess"), @@ -611,7 +609,6 @@ class WorkspaceServiceUnitTests resultWorkspace.get.workspace shouldBe details } } - } it should "return the highest access level" in { val workspaceSamResource = SamUserResource( @@ -642,7 +639,7 @@ class WorkspaceServiceUnitTests resultWorkspace.get.accessLevel shouldBe WorkspaceAccessLevels.Owner } - it should "return the matching value of canShare" in { + it should "return the matching value of canShare" in forAll( Table( ("highestAccessLevel", "additionalRoles", "canShareResult"), @@ -686,9 +683,8 @@ class WorkspaceServiceUnitTests } resultWorkspace.get.canShare.get shouldBe canShareResult } - } - it should "return the matching value of canCompute" in { + it should "return the matching value of canCompute" in forAll( Table( ("cloudPlatform", "highestAccessLevel", "additionalRoles", "canComputeResult"), @@ -760,7 +756,6 @@ class WorkspaceServiceUnitTests } resultWorkspace.get.canCompute.get shouldBe canComputeResult } - } it should "map the results of the resource auth domains" in { val authGroupName = "expected-auth-group" diff --git a/google/src/test/scala/org/broadinstitute/dsde/rawls/google/GoogleUtilitiesSpec.scala b/google/src/test/scala/org/broadinstitute/dsde/rawls/google/GoogleUtilitiesSpec.scala index e30f9aa71f..fe2f47ddf2 100644 --- a/google/src/test/scala/org/broadinstitute/dsde/rawls/google/GoogleUtilitiesSpec.scala +++ b/google/src/test/scala/org/broadinstitute/dsde/rawls/google/GoogleUtilitiesSpec.scala @@ -143,7 +143,7 @@ class GoogleUtilitiesSpec when500orGoogleError(new IOException("boom")) shouldBe true } - "retryWhen500orGoogleError" should "retry once per backoff interval and then fail" in { + "retryWhen500orGoogleError" should "retry once per backoff interval and then fail" in withStatsD { val counter = new Counter() whenReady(retryWhen500orGoogleError(() => counter.alwaysBoom()).failed) { f => @@ -154,7 +154,6 @@ class GoogleUtilitiesSpec capturedMetrics should contain("test.histo.samples", "1") capturedMetrics should contain("test.histo.max", "4") // 4 exceptions } - } it should "not retry after a success" in withStatsD { @@ -168,7 +167,7 @@ class GoogleUtilitiesSpec capturedMetrics should contain("test.histo.max", "1") // 1 exception } - "retryWithRecoverWhen500orGoogleError" should "stop retrying if it recovers" in { + "retryWithRecoverWhen500orGoogleError" should "stop retrying if it recovers" in withStatsD { val counter = new Counter() @@ -184,7 +183,6 @@ class GoogleUtilitiesSpec capturedMetrics should contain("test.histo.samples", "1") capturedMetrics should contain("test.histo.max", "0") // 0 exceptions } - } it should "keep retrying and fail if it doesn't recover" in withStatsD { diff --git a/google/src/test/scala/org/broadinstitute/dsde/rawls/integrationtest/HttpGooglePubSubDAOSpec.scala b/google/src/test/scala/org/broadinstitute/dsde/rawls/integrationtest/HttpGooglePubSubDAOSpec.scala index bea27bd17e..c00f21c65b 100644 --- a/google/src/test/scala/org/broadinstitute/dsde/rawls/integrationtest/HttpGooglePubSubDAOSpec.scala +++ b/google/src/test/scala/org/broadinstitute/dsde/rawls/integrationtest/HttpGooglePubSubDAOSpec.scala @@ -101,7 +101,7 @@ class HttpGooglePubSubDAOSpec ) {} } - it should "gracefully handle there being no messages in the queue" in { + it should "gracefully handle there being no messages in the queue" in Await.result(gpsDAO.withMessage(defaultSubscriptionName) { msg => assertResult(None) { msg @@ -110,7 +110,6 @@ class HttpGooglePubSubDAOSpec }, Duration.Inf ) - } it should "do all of the things with multiple messages" in { // publish a few messages to the topic diff --git a/google/src/test/scala/org/broadinstitute/dsde/rawls/metrics/GoogleInstrumentedSpec.scala b/google/src/test/scala/org/broadinstitute/dsde/rawls/metrics/GoogleInstrumentedSpec.scala index 3f8af3128b..e4730e70b7 100644 --- a/google/src/test/scala/org/broadinstitute/dsde/rawls/metrics/GoogleInstrumentedSpec.scala +++ b/google/src/test/scala/org/broadinstitute/dsde/rawls/metrics/GoogleInstrumentedSpec.scala @@ -51,7 +51,7 @@ class GoogleInstrumentedSpec case exception: HttpResponseException => exception // return the exception } - "GoogleInstrumented" should "get counters from a request/response" in { + "GoogleInstrumented" should "get counters from a request/response" in GoogleInstrumentedService.values.foreach { implicit service => withStatsD { val counters = googleCounters @@ -72,9 +72,8 @@ class GoogleInstrumentedSpec ) } } - } - it should "get counters from a request/HttpResponseException" in { + it should "get counters from a request/HttpResponseException" in GoogleInstrumentedService.values.foreach { implicit service => withStatsD { val counters = googleCounters @@ -95,7 +94,6 @@ class GoogleInstrumentedSpec ) } } - } it should "get counters from a request/exception" in GoogleInstrumentedService.values.foreach { implicit service => diff --git a/model/src/test/scala/org/broadinstitute/dsde/rawls/model/WorkspaceModelSpec.scala b/model/src/test/scala/org/broadinstitute/dsde/rawls/model/WorkspaceModelSpec.scala index e16bb7ce81..0cbf8eea99 100644 --- a/model/src/test/scala/org/broadinstitute/dsde/rawls/model/WorkspaceModelSpec.scala +++ b/model/src/test/scala/org/broadinstitute/dsde/rawls/model/WorkspaceModelSpec.scala @@ -151,7 +151,7 @@ class WorkspaceModelSpec extends AnyFreeSpec with Matchers { } } - "DockstoreTools" in { + "DockstoreTools" in assertResult { DockstoreToolsMethod("test-path", "test-version") } { @@ -159,7 +159,6 @@ class WorkspaceModelSpec extends AnyFreeSpec with Matchers { """{"sourceRepo":"dockstoretools","methodPath":"test-path","methodVersion":"test-version"}""".parseJson ) } - } // Bad "sourceRepo" intercept[spray.json.DeserializationException] { From 836df1dce5c82d748abb90781b21b6d6f433fa7c Mon Sep 17 00:00:00 2001 From: broadbot Date: Mon, 27 Jan 2025 12:05:03 +0000 Subject: [PATCH 6/7] Add 'Reformat with scalafmt 3.8.6' to .git-blame-ignore-revs --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index d0a1985cde..0ea6319425 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -35,3 +35,6 @@ f5916aefb603a97498617785baa46bf5cf9e3164 # Scala Steward: Reformat with scalafmt 3.8.4 1381b307683c6b0a9db4e2fe94a5819b520d7253 + +# Scala Steward: Reformat with scalafmt 3.8.6 +00ab6a6678505b83488ace234e7b98c855b0e19a From b22f2f09e788e602b1bbea709dc4ac4ccf3cf35a Mon Sep 17 00:00:00 2001 From: broadbot Date: Mon, 27 Jan 2025 12:05:04 +0000 Subject: [PATCH 7/7] CORE-69: Update cats-core from 2.12.0 to 2.13.0 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index b13f04a756..8b3f67fde6 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -67,7 +67,7 @@ object Dependencies { val sentryLogback: ModuleID = "io.sentry" % "sentry-logback" % "7.20.1" val webjarsLocator: ModuleID = "org.webjars" % "webjars-locator" % "0.52" val commonsJEXL: ModuleID = "org.apache.commons" % "commons-jexl" % "2.1.1" - val cats: ModuleID = "org.typelevel" %% "cats-core" % "2.12.0" + val cats: ModuleID = "org.typelevel" %% "cats-core" % "2.13.0" val logbackClassic: ModuleID = "ch.qos.logback" % "logback-classic" % "1.5.16" val scalaUri: ModuleID = "io.lemonlabs" %% "scala-uri" % "3.0.0" val scalatest: ModuleID = "org.scalatest" %% "scalatest" % "3.2.19" % "test"