From c844ff7851612130e3501569efd81a8421c25475 Mon Sep 17 00:00:00 2001 From: Chris Llanwarne Date: Tue, 12 Dec 2023 15:38:19 -0500 Subject: [PATCH] and the tests --- .../org/broadinstitute/dsde/rawls/Boot.scala | 4 +-- .../dsde/rawls/TestExecutionContext.scala | 4 +-- .../HttpExecutionServiceDAOSpec.scala | 4 +-- .../rawls/dataaccess/HttpSamDAOSpec.scala | 2 +- .../SubmissionCostServiceSpec.scala | 2 +- .../dataaccess/drs/DrsHubResolverSpec.scala | 6 ++-- .../slick/DriverComponentSpec.scala | 2 +- .../slick/TestDriverComponent.scala | 11 ++---- ...ataRepoEntityExpressionValidatorSpec.scala | 2 +- .../DataRepoEntityProviderBuilderSpec.scala | 3 +- ...aRepoEntityProviderQueryEntitiesSpec.scala | 9 ++--- .../datarepo/DataRepoEntityProviderSpec.scala | 25 +++---------- .../entities/local/CaseSensitivitySpec.scala | 2 +- .../rawls/fastpass/FastPassMonitorSpec.scala | 16 ++++----- .../rawls/fastpass/FastPassServiceSpec.scala | 18 ++++------ .../rawls/jobexec/SubmissionMonitorSpec.scala | 2 +- .../dsde/rawls/jobexec/SubmissionSpec.scala | 13 +++---- .../jobexec/SubmissionSupervisorSpec.scala | 2 +- .../jobexec/WorkflowSubmissionSpec.scala | 2 +- .../rawls/monitor/HealthMonitorSpec.scala | 4 +-- ...ultiregionalBucketMigrationActorSpec.scala | 14 +++----- .../rawls/webservice/ApiServiceSpec.scala | 35 +++++-------------- .../MethodConfigApiServiceSpec.scala | 2 +- .../webservice/SnapshotApiServiceSpec.scala | 6 ++-- .../webservice/StatusApiServiceSpec.scala | 2 +- .../webservice/SubmissionApiServiceSpec.scala | 2 +- .../WorkspaceApiLibraryPermissionsSpec.scala | 2 +- .../webservice/WorkspaceApiServiceSpec.scala | 4 +-- .../workspace/WorkspaceServiceSpec.scala | 22 +++--------- .../rawls/google/GoogleUtilitiesSpec.scala | 7 ++-- ...ttpGoogleAccessContextManagerDAOSpec.scala | 4 +-- .../HttpGooglePubSubDAOSpec.scala | 2 +- .../dsde/rawls/metrics/MetricsSpec.scala | 2 +- .../dsde/rawls/util/RetrySpec.scala | 2 +- .../util/ThresholdOneForOneStrategySpec.scala | 2 +- 35 files changed, 87 insertions(+), 154 deletions(-) diff --git a/core/src/main/scala/org/broadinstitute/dsde/rawls/Boot.scala b/core/src/main/scala/org/broadinstitute/dsde/rawls/Boot.scala index 151f849849..edf324425b 100644 --- a/core/src/main/scala/org/broadinstitute/dsde/rawls/Boot.scala +++ b/core/src/main/scala/org/broadinstitute/dsde/rawls/Boot.scala @@ -94,8 +94,8 @@ object Boot extends IOApp with LazyLogging { val gcsConfig = conf.getConfig("gcs") // we need an ActorSystem to host our application in - implicit val system = ActorSystem("rawls") - implicit val materializer = ActorMaterializer() + implicit val system: ActorSystem = ActorSystem("rawls") + implicit val materializer: ActorMaterializer = ActorMaterializer() val slickDataSource = DataSource(DatabaseConfig.forConfig[JdbcProfile]("slick", conf)) diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/TestExecutionContext.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/TestExecutionContext.scala index 8bbdf5f92b..882082f3d6 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/TestExecutionContext.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/TestExecutionContext.scala @@ -5,13 +5,13 @@ import com.typesafe.config.Config import java.util.concurrent._ import java.util.concurrent.atomic.AtomicInteger -import scala.concurrent.ExecutionContextExecutor +import scala.concurrent.{ExecutionContext, ExecutionContextExecutor} /** * Created by dvoet on 10/9/15. */ object TestExecutionContext { - implicit val testExecutionContext = new TestExecutionContext() + implicit val testExecutionContext: TestExecutionContext = new TestExecutionContext() } class TestExecutionContext() extends ExecutionContextExecutor { val pool = Executors.newCachedThreadPool() 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 7a604a8985..60b9988f73 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 @@ -40,8 +40,8 @@ class HttpExecutionServiceDAOSpec with MockitoTestUtils with RawlsStatsDTestUtils { - implicit val materializer = ActorMaterializer() - implicit override val patienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) + implicit val materializer: ActorMaterializer = ActorMaterializer() + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) val mockServer = RemoteServicesMockServer() val userInfo = UserInfo(RawlsUserEmail("owner-access"), diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/HttpSamDAOSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/HttpSamDAOSpec.scala index 7a78e8d42b..ddfd65e635 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/HttpSamDAOSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/HttpSamDAOSpec.scala @@ -36,7 +36,7 @@ class HttpSamDAOSpec with Matchers with BeforeAndAfterAll { - implicit val materializer = ActorMaterializer() + implicit val materializer: ActorMaterializer = ActorMaterializer() val mockServer = RemoteServicesMockServer() override def beforeAll(): Unit = { diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/SubmissionCostServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/SubmissionCostServiceSpec.scala index 7716729c60..e2179c8b37 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/SubmissionCostServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/SubmissionCostServiceSpec.scala @@ -14,7 +14,7 @@ import scala.jdk.CollectionConverters._ import scala.language.postfixOps class SubmissionCostServiceSpec extends AnyFlatSpec with RawlsTestUtils { - implicit val actorSystem = ActorSystem("SubmissionCostServiceSpec") + implicit val actorSystem: ActorSystem = ActorSystem("SubmissionCostServiceSpec") val mockBigQueryDAO = new MockGoogleBigQueryDAO val submissionCostService = SubmissionCostService.constructor( "fakeTableName", diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/drs/DrsHubResolverSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/drs/DrsHubResolverSpec.scala index 00b5decf2e..85b9f1b089 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/drs/DrsHubResolverSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/drs/DrsHubResolverSpec.scala @@ -7,15 +7,15 @@ import akka.http.scaladsl.model.headers.OAuth2BearerToken import akka.testkit.TestKit import org.broadinstitute.dsde.rawls.model.UserInfo import org.mockito.ArgumentMatchers.any -import org.mockito.Mockito.{doReturn, spy, when, RETURNS_SMART_NULLS} +import org.mockito.Mockito.{RETURNS_SMART_NULLS, doReturn, spy, when} import org.scalatest.flatspec.AnyFlatSpecLike -import scala.concurrent.{Await, ExecutionContext, Future} +import scala.concurrent.{Await, ExecutionContext, ExecutionContextExecutor, Future} import scala.concurrent.duration.DurationInt import scala.language.postfixOps class DrsHubResolverSpec extends TestKit(ActorSystem("DrsHubResolverSpec")) with AnyFlatSpecLike { - implicit val executionContext = ExecutionContext.global + implicit val executionContext: ExecutionContextExecutor = ExecutionContext.global val mockDrsHubResolver = spy(new DrsHubResolver("foo@bar.com")) val mockUserInfo = mock[UserInfo](RETURNS_SMART_NULLS) diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/DriverComponentSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/DriverComponentSpec.scala index ce6d44db07..15212f63fd 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/DriverComponentSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/DriverComponentSpec.scala @@ -14,7 +14,7 @@ class DriverComponentSpec extends TestDriverComponentWithFlatSpecAndMatchers wit // validateAttributeName // createBatches - implicit val getWorkflowRecord = GetResult { r => + implicit val getWorkflowRecord: GetResult[WorkflowRecord] = GetResult { r => WorkflowRecord(r.<<, r.<<, r.<<, r.<<, r.<<, r.<<, r.<<, r.<<, r.<<) } diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/TestDriverComponent.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/TestDriverComponent.scala index 9c4b78d4d5..f2d98963eb 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/TestDriverComponent.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/dataaccess/slick/TestDriverComponent.scala @@ -7,12 +7,7 @@ import com.typesafe.scalalogging.LazyLogging import nl.grons.metrics4.scala.{Counter, DefaultInstrumented, MetricName} import org.broadinstitute.dsde.rawls.TestExecutionContext import org.broadinstitute.dsde.rawls.config.WDLParserConfig -import org.broadinstitute.dsde.rawls.dataaccess.MockCromwellSwaggerClient.{ - makeToolInputParameter, - makeToolOutputParameter, - makeValueType, - makeWorkflowDescription -} +import org.broadinstitute.dsde.rawls.dataaccess.MockCromwellSwaggerClient.{makeToolInputParameter, makeToolOutputParameter, makeValueType, makeWorkflowDescription} import slick.basic.DatabaseConfig import slick.jdbc.JdbcProfile import slick.jdbc.MySQLProfile.api._ @@ -35,7 +30,7 @@ import org.scalatest.matchers.should.Matchers import java.sql.SQLTransactionRollbackException import java.util.UUID import scala.concurrent.duration._ -import scala.concurrent.{Await, Future} +import scala.concurrent.{Await, ExecutionContext, Future} import scala.language.{implicitConversions, postfixOps} // initialize database tables and connection pool only once @@ -63,7 +58,7 @@ object DbResource extends LazyLogging { trait TestDriverComponent extends DriverComponent with DataAccess with DefaultInstrumented { this: Suite => - implicit override val executionContext = TestExecutionContext.testExecutionContext + implicit override val executionContext: TestExecutionContext = TestExecutionContext.testExecutionContext // Implicit counters are required for certain methods on WorkflowComponent and SubmissionComponent override lazy val metricBaseName = MetricName("test") diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityExpressionValidatorSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityExpressionValidatorSpec.scala index 37e90f8c04..e12fc963d8 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityExpressionValidatorSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityExpressionValidatorSpec.scala @@ -101,7 +101,7 @@ class DataRepoEntityExpressionValidatorSpec AgoraMethod("dsde", "three_step", 1) ) - implicit override val patienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) "validateMCExpressions" should "validate expressions in a MethodConfiguration with a root entity" in { val validationResults = diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderBuilderSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderBuilderSpec.scala index 637f691e26..b355560c03 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderBuilderSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/datarepo/DataRepoEntityProviderBuilderSpec.scala @@ -11,6 +11,7 @@ import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers import java.util.UUID +import scala.concurrent.ExecutionContext import scala.util.Failure class DataRepoEntityProviderBuilderSpec @@ -18,7 +19,7 @@ class DataRepoEntityProviderBuilderSpec with DataRepoEntityProviderSpecSupport with TestDriverComponent with Matchers { - implicit override val executionContext = TestExecutionContext.testExecutionContext + implicit override val executionContext: TestExecutionContext = TestExecutionContext.testExecutionContext val defaultEntityRequestArguments = EntityRequestArguments(workspace, testContext, Some(DataReferenceName("referenceName"))) 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 256c58dca4..acb4487091 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 @@ -8,15 +8,12 @@ import org.broadinstitute.dsde.rawls.dataaccess.MockBigQueryServiceFactory import org.broadinstitute.dsde.rawls.dataaccess.MockBigQueryServiceFactory.{createKeyList, createTestTableResult} import org.broadinstitute.dsde.rawls.dataaccess.slick.TestDriverComponent import org.broadinstitute.dsde.rawls.entities.EntityRequestArguments -import org.broadinstitute.dsde.rawls.entities.exceptions.{ - DataEntityException, - EntityTypeNotFoundException, - UnsupportedEntityOperationException -} +import org.broadinstitute.dsde.rawls.entities.exceptions.{DataEntityException, EntityTypeNotFoundException, UnsupportedEntityOperationException} import org.broadinstitute.dsde.rawls.model._ import org.scalatest.flatspec.AsyncFlatSpec import org.scalatest.matchers.should.Matchers +import scala.concurrent.ExecutionContext import scala.jdk.CollectionConverters._ class DataRepoEntityProviderQueryEntitiesSpec @@ -25,7 +22,7 @@ class DataRepoEntityProviderQueryEntitiesSpec with TestDriverComponent with Matchers { - implicit override val executionContext = TestExecutionContext.testExecutionContext + implicit override val executionContext: TestExecutionContext = TestExecutionContext.testExecutionContext val defaultEntityRequestArguments = EntityRequestArguments(workspace, testContext, Some(DataReferenceName("referenceName"))) 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 19a783afe8..0b87ebdd47 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 @@ -14,27 +14,10 @@ import org.broadinstitute.dsde.rawls.entities.EntityRequestArguments import org.broadinstitute.dsde.rawls.entities.base.ExpressionEvaluationContext import org.broadinstitute.dsde.rawls.entities.base.ExpressionEvaluationSupport.ExpressionAndResult import org.broadinstitute.dsde.rawls.entities.datarepo.DataRepoBigQuerySupport._ -import org.broadinstitute.dsde.rawls.entities.exceptions.{ - DataEntityException, - EntityNotFoundException, - EntityTypeNotFoundException -} +import org.broadinstitute.dsde.rawls.entities.exceptions.{DataEntityException, EntityNotFoundException, EntityTypeNotFoundException} import org.broadinstitute.dsde.rawls.expressions.parser.antlr.ParsedEntityLookupExpression import org.broadinstitute.dsde.rawls.jobexec.MethodConfigResolver.{GatherInputsResult, MethodInput} -import org.broadinstitute.dsde.rawls.model.{ - AttributeBoolean, - AttributeName, - AttributeNumber, - AttributeString, - AttributeValue, - AttributeValueRawJson, - DataReferenceName, - Entity, - EntityTypeMetadata, - GoogleProjectId, - SubmissionValidationEntityInputs, - SubmissionValidationValue -} +import org.broadinstitute.dsde.rawls.model.{AttributeBoolean, AttributeName, AttributeNumber, AttributeString, AttributeValue, AttributeValueRawJson, DataReferenceName, Entity, EntityTypeMetadata, GoogleProjectId, SubmissionValidationEntityInputs, SubmissionValidationValue} import org.broadinstitute.dsde.rawls.{RawlsExceptionWithErrorReport, TestExecutionContext} import org.mockserver.integration.ClientAndServer.startClientAndServer import org.mockserver.model.Header @@ -43,7 +26,7 @@ import org.mockserver.model.HttpResponse.response import org.scalatest.flatspec.AsyncFlatSpec import org.scalatest.matchers.should.Matchers -import scala.concurrent.Await +import scala.concurrent.{Await, ExecutionContext} import scala.concurrent.duration.Duration import scala.jdk.CollectionConverters._ import scala.util.{Random, Success} @@ -54,7 +37,7 @@ class DataRepoEntityProviderSpec with TestDriverComponent with Matchers { - implicit override val executionContext = TestExecutionContext.testExecutionContext + implicit override val executionContext: TestExecutionContext = TestExecutionContext.testExecutionContext behavior of "DataRepoEntityProvider.googleProject" diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/local/CaseSensitivitySpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/local/CaseSensitivitySpec.scala index 8bd82611a7..00456055ed 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/local/CaseSensitivitySpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/entities/local/CaseSensitivitySpec.scala @@ -48,7 +48,7 @@ import scala.concurrent.duration.Duration class CaseSensitivitySpec extends AnyFreeSpec with Matchers with TestDriverComponent with ScalaFutures { - implicit val actorSystem = ActorSystem() // needed for stream materialization + implicit val actorSystem: ActorSystem = ActorSystem() // needed for stream materialization // =================================================================================================================== // exemplar data used in multiple tests diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/fastpass/FastPassMonitorSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/fastpass/FastPassMonitorSpec.scala index af41c22134..f0ce28d9d1 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/fastpass/FastPassMonitorSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/fastpass/FastPassMonitorSpec.scala @@ -3,6 +3,7 @@ package org.broadinstitute.dsde.rawls.fastpass import akka.actor.PoisonPill import akka.http.scaladsl.model.headers.OAuth2BearerToken import akka.http.scaladsl.testkit.ScalatestRouteTest +import cats.effect.IO import com.typesafe.config.ConfigFactory import org.broadinstitute.dsde.rawls.{RawlsException, RawlsTestUtils} import org.broadinstitute.dsde.rawls.billing.BillingProfileManagerDAOImpl @@ -26,19 +27,14 @@ import org.broadinstitute.dsde.rawls.serviceperimeter.ServicePerimeterService import org.broadinstitute.dsde.rawls.user.UserService import org.broadinstitute.dsde.rawls.util.MockitoTestUtils import org.broadinstitute.dsde.rawls.webservice._ -import org.broadinstitute.dsde.rawls.workspace.{ - MultiCloudWorkspaceAclManager, - MultiCloudWorkspaceService, - RawlsWorkspaceAclManager, - WorkspaceService -} +import org.broadinstitute.dsde.rawls.workspace.{MultiCloudWorkspaceAclManager, MultiCloudWorkspaceService, RawlsWorkspaceAclManager, WorkspaceService} import org.broadinstitute.dsde.workbench.dataaccess.{NotificationDAO, PubSubNotificationDAO} import org.broadinstitute.dsde.workbench.google.mock.{MockGoogleBigQueryDAO, MockGoogleIamDAO, MockGoogleStorageDAO} import org.broadinstitute.dsde.workbench.model.WorkbenchEmail import org.broadinstitute.dsde.workbench.model.google.iam.IamMemberTypes.IamMemberType import org.broadinstitute.dsde.workbench.model.google.iam._ import org.broadinstitute.dsde.workbench.model.google.{GcsBucketName, GoogleProject} -import org.broadinstitute.dsde.workbench.openTelemetry.FakeOpenTelemetryMetricsInterpreter +import org.broadinstitute.dsde.workbench.openTelemetry.{FakeOpenTelemetryMetricsInterpreter, OpenTelemetryMetrics} import org.mockito.ArgumentMatchers._ import org.mockito.Mockito._ import org.mockito.{ArgumentMatchers, Mockito} @@ -107,7 +103,7 @@ class FastPassMonitorSpec with SubmissionApiService with MockUserInfoDirectivesWithUser { val ctx1 = RawlsRequestContext(UserInfo(user.userEmail, OAuth2BearerToken("foo"), 0, user.userSubjectId)) - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter lazy val workspaceService: WorkspaceService = workspaceServiceConstructor(ctx1) lazy val userService: UserService = userServiceConstructor(ctx1) @@ -325,7 +321,7 @@ class FastPassMonitorSpec } "FastPassMonitor" should "remove expired fastpass grants" in withTestDataServicesFastPassGrantPeriodZero { services => - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter val fastPassMonitor = system.actorOf(FastPassMonitor.props(services.slickDataSource, services.googleIamDAO, services.googleStorageDAO)) @@ -388,7 +384,7 @@ class FastPassMonitorSpec } it should "continue cleaning up even if it encounters an error" in withTestDataServicesFastPassGrantPeriodZero { - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter services => when( services.googleStorageDAO.removeIamRoles( diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/fastpass/FastPassServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/fastpass/FastPassServiceSpec.scala index 3458f1867f..4aa4decd8c 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/fastpass/FastPassServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/fastpass/FastPassServiceSpec.scala @@ -3,6 +3,7 @@ package org.broadinstitute.dsde.rawls.fastpass import akka.actor.PoisonPill import akka.http.scaladsl.model.headers.OAuth2BearerToken import akka.http.scaladsl.testkit.ScalatestRouteTest +import cats.effect.IO import com.google.api.services.iam.v1.model.Role import com.typesafe.config.ConfigFactory import org.broadinstitute.dsde.rawls.billing.BillingProfileManagerDAOImpl @@ -27,12 +28,7 @@ import org.broadinstitute.dsde.rawls.user.UserService import org.broadinstitute.dsde.rawls.util.MockitoTestUtils import org.broadinstitute.dsde.rawls.webservice._ import org.broadinstitute.dsde.rawls.workspace.WorkspaceService.BUCKET_GET_PERMISSION -import org.broadinstitute.dsde.rawls.workspace.{ - MultiCloudWorkspaceAclManager, - MultiCloudWorkspaceService, - RawlsWorkspaceAclManager, - WorkspaceService -} +import org.broadinstitute.dsde.rawls.workspace.{MultiCloudWorkspaceAclManager, MultiCloudWorkspaceService, RawlsWorkspaceAclManager, WorkspaceService} import org.broadinstitute.dsde.rawls.{RawlsException, RawlsExceptionWithErrorReport, RawlsTestUtils} import org.broadinstitute.dsde.workbench.dataaccess.{NotificationDAO, PubSubNotificationDAO} import org.broadinstitute.dsde.workbench.google.HttpGoogleIamDAO.toProjectPolicy @@ -42,7 +38,7 @@ import org.broadinstitute.dsde.workbench.model.google.iam.IamMemberTypes.IamMemb import org.broadinstitute.dsde.workbench.model.google.iam._ import org.broadinstitute.dsde.workbench.model.google.{GcsBucketName, GoogleProject, IamPermission} import org.broadinstitute.dsde.workbench.model.{WorkbenchEmail, WorkbenchUserId} -import org.broadinstitute.dsde.workbench.openTelemetry.FakeOpenTelemetryMetricsInterpreter +import org.broadinstitute.dsde.workbench.openTelemetry.{FakeOpenTelemetryMetricsInterpreter, OpenTelemetryMetrics} import org.mockito.ArgumentMatchers._ import org.mockito.Mockito._ import org.mockito.{ArgumentMatchers, Mockito} @@ -53,7 +49,7 @@ import org.scalatest.prop.TableDrivenPropertyChecks import org.scalatest.{BeforeAndAfterAll, OneInstancePerTest, OptionValues} import java.sql.Timestamp -import java.time.{Duration => JavaDuration, LocalDateTime, OffsetDateTime, ZoneOffset} +import java.time.{LocalDateTime, OffsetDateTime, ZoneOffset, Duration => JavaDuration} import java.util.UUID import java.util.concurrent.TimeUnit import scala.collection.JavaConverters._ @@ -137,7 +133,7 @@ class FastPassServiceSpec with SubmissionApiService with MockUserInfoDirectivesWithUser { val ctx1 = RawlsRequestContext(UserInfo(user.userEmail, OAuth2BearerToken("foo"), 0, user.userSubjectId)) - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter lazy val workspaceService: WorkspaceService = workspaceServiceConstructor(ctx1) lazy val userService: UserService = userServiceConstructor(ctx1) @@ -1408,7 +1404,7 @@ class FastPassServiceSpec ) ) val config = FastPassConfig(true, JavaDuration.ZERO, JavaDuration.ZERO) - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter val iamDAO = spy(new MockGoogleIamDAO) val storageDAO = spy(new MockGoogleStorageDAO) val gcsDAO = spy(new MockGoogleServicesDAO("groupsPrefix")) @@ -1446,7 +1442,7 @@ class FastPassServiceSpec ) ) val config = FastPassConfig(true, JavaDuration.ZERO, JavaDuration.ZERO) - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter val iamDAO = spy(new MockGoogleIamDAO) val storageDAO = spy(new MockGoogleStorageDAO) val gcsDAO = spy(new MockGoogleServicesDAO("groupsPrefix")) 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 e06f9c320c..afa00ec4c5 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 @@ -52,7 +52,7 @@ class SubmissionMonitorSpec(_system: ActorSystem) def this() = this(ActorSystem("WorkflowMonitorSpec")) - implicit val materializer = ActorMaterializer() + implicit val materializer: ActorMaterializer = ActorMaterializer() val testDbName = "SubmissionMonitorSpec" val mockServer = RemoteServicesMockServer() 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 c577da924c..48c7b48b7c 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 @@ -6,6 +6,7 @@ import akka.stream.ActorMaterializer import akka.testkit.TestKit import bio.terra.datarepo.model.{ColumnModel, TableModel} import bio.terra.workspace.model.CloningInstructionsEnum +import cats.effect.IO import com.google.cloud.PageImpl import com.google.cloud.bigquery.{Option => _, _} import com.typesafe.config.ConfigFactory @@ -29,16 +30,12 @@ import org.broadinstitute.dsde.rawls.resourcebuffer.ResourceBufferService import org.broadinstitute.dsde.rawls.serviceperimeter.ServicePerimeterService import org.broadinstitute.dsde.rawls.user.UserService import org.broadinstitute.dsde.rawls.util.MockitoTestUtils -import org.broadinstitute.dsde.rawls.workspace.{ - MultiCloudWorkspaceAclManager, - RawlsWorkspaceAclManager, - WorkspaceService -} +import org.broadinstitute.dsde.rawls.workspace.{MultiCloudWorkspaceAclManager, RawlsWorkspaceAclManager, WorkspaceService} import org.broadinstitute.dsde.rawls.{RawlsException, RawlsExceptionWithErrorReport, RawlsTestUtils} import org.broadinstitute.dsde.workbench.dataaccess.{NotificationDAO, PubSubNotificationDAO} import org.broadinstitute.dsde.workbench.google.mock.{MockGoogleBigQueryDAO, MockGoogleIamDAO, MockGoogleStorageDAO} import org.broadinstitute.dsde.workbench.model.WorkbenchEmail -import org.broadinstitute.dsde.workbench.openTelemetry.FakeOpenTelemetryMetricsInterpreter +import org.broadinstitute.dsde.workbench.openTelemetry.{FakeOpenTelemetryMetricsInterpreter, OpenTelemetryMetrics} import org.mockito.Mockito._ import org.scalatest.BeforeAndAfterAll import org.scalatest.concurrent.Eventually @@ -75,7 +72,7 @@ class SubmissionSpec(_system: ActorSystem) import driver.api._ def this() = this(ActorSystem("SubmissionSpec")) - implicit val materializer = ActorMaterializer() + implicit val materializer: ActorMaterializer = ActorMaterializer() val testDbName = "SubmissionSpec" val submissionSupervisorActorName = "test-subspec-submission-supervisor" @@ -419,7 +416,7 @@ class SubmissionSpec(_system: ActorSystem) withDataOp { dataSource => val execServiceCluster: ExecutionServiceCluster = MockShardedExecutionServiceCluster.fromDAO(executionServiceDAO, dataSource) - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter val config = SubmissionMonitorConfig(250.milliseconds, 30 days, trackDetailedSubmissionMetrics = true, 20000, false) diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionSupervisorSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionSupervisorSpec.scala index 684d528403..49fcdc6887 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionSupervisorSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/SubmissionSupervisorSpec.scala @@ -43,7 +43,7 @@ class SubmissionSupervisorSpec with MockitoTestUtils with RawlsStatsDTestUtils { - implicit val materializer = ActorMaterializer() + implicit val materializer: ActorMaterializer = ActorMaterializer() val testDbName = "SubmissionSupervisorSpec" val submissionSupervisorActorName = "test-subsupervisorspec-submission-supervisor" diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/WorkflowSubmissionSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/WorkflowSubmissionSpec.scala index 0deb277be1..53a5725e8f 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/WorkflowSubmissionSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/jobexec/WorkflowSubmissionSpec.scala @@ -61,7 +61,7 @@ class WorkflowSubmissionSpec(_system: ActorSystem) with MockitoTestUtils with RawlsStatsDTestUtils { import driver.api._ - implicit val materializer = ActorMaterializer() + implicit val materializer: ActorMaterializer = ActorMaterializer() def this() = this(ActorSystem("WorkflowSubmissionSpec")) val mockServer = RemoteServicesMockServer() 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 3fea253261..57c5448e27 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 @@ -39,12 +39,12 @@ class HealthMonitorSpec with BeforeAndAfterAll { // actor ask timeout - implicit val timeout = Timeout(5 seconds) + implicit val timeout: Timeout = Timeout(5 seconds) // This configures how long the calls to `whenReady(Future)` and `eventually` will wait // before giving up and failing the test. // See: http://doc.scalatest.org/2.2.4/index.html#org.scalatest.concurrent.Futures - implicit override val patienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) override def afterAll(): Unit = TestKit.shutdownActorSystem(system) diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/MultiregionalBucketMigrationActorSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/MultiregionalBucketMigrationActorSpec.scala index 27ca4b665c..0357d5f12d 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/MultiregionalBucketMigrationActorSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/monitor/MultiregionalBucketMigrationActorSpec.scala @@ -17,12 +17,7 @@ import org.broadinstitute.dsde.rawls.monitor.migration.MigrationUtils.Implicits. import org.broadinstitute.dsde.rawls.monitor.migration.MigrationUtils.Outcome import org.broadinstitute.dsde.rawls.monitor.migration.MigrationUtils.Outcome._ import org.broadinstitute.dsde.rawls.monitor.migration.MultiregionalBucketMigrationActor._ -import org.broadinstitute.dsde.rawls.monitor.migration.{ - MultiregionalBucketMigration, - MultiregionalBucketMigrationFailureModes, - MultiregionalBucketMigrationStep, - MultiregionalStorageTransferJob -} +import org.broadinstitute.dsde.rawls.monitor.migration.{MultiregionalBucketMigration, MultiregionalBucketMigrationFailureModes, MultiregionalBucketMigrationStep, MultiregionalStorageTransferJob} import org.broadinstitute.dsde.rawls.workspace.WorkspaceServiceSpec import org.broadinstitute.dsde.workbench.RetryConfig import org.broadinstitute.dsde.workbench.google.mock.MockGoogleIamDAO @@ -45,14 +40,15 @@ import java.sql.Timestamp import java.time.Instant import java.util.UUID import scala.annotation.nowarn +import scala.concurrent.ExecutionContext import scala.language.postfixOps import scala.util.Random class MultiregionalBucketMigrationActorSpec extends AnyFlatSpecLike with Matchers with Eventually with OptionValues { - implicit val logger = new ConsoleLogger("unit_test", LogLevel(false, false, true, true)) - implicit val ec = IORuntime.global.compute - implicit val timestampOrdering = new Ordering[Timestamp] { + implicit val logger: ConsoleLogger = new ConsoleLogger("unit_test", LogLevel(false, false, true, true)) + implicit val ec: ExecutionContext = IORuntime.global.compute + implicit val timestampOrdering: Ordering[Timestamp] = new Ordering[Timestamp] { override def compare(x: Timestamp, y: Timestamp): Int = x.compareTo(y) } implicit class FailureMessageOps(outcome: Outcome)(implicit pos: source.Position) { diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/ApiServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/ApiServiceSpec.scala index db378ad300..e085f384fb 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/ApiServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/ApiServiceSpec.scala @@ -9,16 +9,11 @@ import akka.http.scaladsl.server._ import akka.http.scaladsl.testkit.{RouteTestTimeout, ScalatestRouteTest} import akka.stream.ActorMaterializer import akka.testkit.TestKitBase +import cats.effect.IO import com.typesafe.config.ConfigFactory import com.typesafe.scalalogging.LazyLogging import org.broadinstitute.dsde.rawls.RawlsTestUtils -import org.broadinstitute.dsde.rawls.billing.{ - BillingProfileManagerDAO, - BillingProjectOrchestrator, - BillingRepository, - BpmBillingProjectLifecycle, - GoogleBillingProjectLifecycle -} +import org.broadinstitute.dsde.rawls.billing.{BillingProfileManagerDAO, BillingProjectOrchestrator, BillingRepository, BpmBillingProjectLifecycle, GoogleBillingProjectLifecycle} import org.broadinstitute.dsde.rawls.bucketMigration.BucketMigrationService import org.broadinstitute.dsde.rawls.config._ import org.broadinstitute.dsde.rawls.coordination.UncoordinatedDataSourceAccess @@ -35,14 +30,7 @@ import org.broadinstitute.dsde.rawls.google.MockGooglePubSubDAO import org.broadinstitute.dsde.rawls.jobexec.{SubmissionMonitorConfig, SubmissionSupervisor} import org.broadinstitute.dsde.rawls.metrics.{InstrumentationDirectives, RawlsInstrumented, RawlsStatsDTestUtils} import org.broadinstitute.dsde.rawls.mock._ -import org.broadinstitute.dsde.rawls.model.{ - Agora, - ApplicationVersion, - Dockstore, - RawlsBillingAccountName, - RawlsRequestContext, - RawlsUser -} +import org.broadinstitute.dsde.rawls.model.{Agora, ApplicationVersion, Dockstore, RawlsBillingAccountName, RawlsRequestContext, RawlsUser} import org.broadinstitute.dsde.rawls.monitor.HealthMonitor import org.broadinstitute.dsde.rawls.resourcebuffer.ResourceBufferService import org.broadinstitute.dsde.rawls.serviceperimeter.ServicePerimeterService @@ -51,17 +39,12 @@ import org.broadinstitute.dsde.rawls.spendreporting.SpendReportingService import org.broadinstitute.dsde.rawls.status.StatusService import org.broadinstitute.dsde.rawls.user.UserService import org.broadinstitute.dsde.rawls.util.MockitoTestUtils -import org.broadinstitute.dsde.rawls.workspace.{ - MultiCloudWorkspaceAclManager, - MultiCloudWorkspaceService, - RawlsWorkspaceAclManager, - WorkspaceService -} +import org.broadinstitute.dsde.rawls.workspace.{MultiCloudWorkspaceAclManager, MultiCloudWorkspaceService, RawlsWorkspaceAclManager, WorkspaceService} import org.broadinstitute.dsde.workbench.dataaccess.{NotificationDAO, PubSubNotificationDAO} import org.broadinstitute.dsde.workbench.google.mock.{MockGoogleBigQueryDAO, MockGoogleIamDAO, MockGoogleStorageDAO} import org.broadinstitute.dsde.workbench.model.google.GoogleProject import org.broadinstitute.dsde.workbench.oauth2.mock.FakeOpenIDConnectConfiguration -import org.broadinstitute.dsde.workbench.openTelemetry.FakeOpenTelemetryMetricsInterpreter +import org.broadinstitute.dsde.workbench.openTelemetry.{FakeOpenTelemetryMetricsInterpreter, OpenTelemetryMetrics} import org.mockito.Mockito.RETURNS_SMART_NULLS import org.mockito.ArgumentMatcher import org.scalatest.concurrent.Eventually @@ -92,10 +75,10 @@ trait ApiServiceSpec // increase the timeout for ScalatestRouteTest from the default of 1 second, otherwise // intermittent failures occur on requests not completing in time - implicit val routeTestTimeout = RouteTestTimeout(5.seconds) + implicit val routeTestTimeout: RouteTestTimeout = RouteTestTimeout(5.seconds) // this gets fed into sealRoute so that exceptions are handled the same in tests as in real life - implicit val exceptionHandler = RawlsApiService.exceptionHandler + implicit val exceptionHandler: ExceptionHandler = RawlsApiService.exceptionHandler override val workbenchMetricBaseName = "test" @@ -165,9 +148,9 @@ trait ApiServiceSpec def actorRefFactory = system - implicit override val materializer = ActorMaterializer() + implicit override val materializer: ActorMaterializer = ActorMaterializer() - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter override val workbenchMetricBaseName: String = "test" override val submissionTimeout = FiniteDuration(1, TimeUnit.MINUTES) 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 fee9ee73d6..8e35a6d17a 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 @@ -24,7 +24,7 @@ import scala.concurrent.duration._ class MethodConfigApiServiceSpec extends ApiServiceSpec with TestDriverComponent with ScalaFutures { // increate the timeout for ScalatestRouteTest from the default of 1 second, otherwise // intermittent failures occur on requests not completing in time - implicit override val routeTestTimeout = RouteTestTimeout(500.seconds) + implicit override val routeTestTimeout: RouteTestTimeout = RouteTestTimeout(500.seconds) case class TestApiService(dataSource: SlickDataSource, gcsDAO: MockGoogleServicesDAO, gpsDAO: MockGooglePubSubDAO)( implicit override val executionContext: ExecutionContext diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/SnapshotApiServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/SnapshotApiServiceSpec.scala index b3122559e8..fb718d31b5 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/SnapshotApiServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/SnapshotApiServiceSpec.scala @@ -74,16 +74,16 @@ class SnapshotApiServiceSpec extends ApiServiceSpec { apiService.cleanupSupervisor } - def withApiServicesSecure[T](dataSource: SlickDataSource, user: String = testData.userOwner.userEmail.value)( + def withApiServicesSecure[T](dataSource: SlickDataSource, withUser: String = testData.userOwner.userEmail.value)( testCode: TestApiService => T ): T = { val apiService = new TestApiService(dataSource, - user, + withUser, new MockGoogleServicesDAO("test"), new MockGooglePubSubDAO, new SnapshotApiServiceSpecWorkspaceManagerDAO() ) { - override val samDAO: MockSamDAO = new MockSamDAO(dataSource) { + override val samDAO: MockSamDAO = new MockSamDAO(this.dataSource) { override def userHasAction(resourceTypeName: SamResourceTypeName, resourceId: String, action: SamResourceAction, diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/StatusApiServiceSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/StatusApiServiceSpec.scala index 92ca229862..8c0c070644 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/StatusApiServiceSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/StatusApiServiceSpec.scala @@ -35,7 +35,7 @@ class StatusApiServiceSpec extends ApiServiceSpec with Eventually { // This configures how long the calls to `whenReady(Future)` and `eventually` will wait // before giving up and failing the test. // See: http://doc.scalatest.org/2.2.4/index.html#org.scalatest.concurrent.Futures - implicit override val patienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) case class TestApiService(dataSource: SlickDataSource, gcsDAO: MockGoogleServicesDAO, gpsDAO: MockGooglePubSubDAO)( implicit override val executionContext: ExecutionContext 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 2393018e1b..d6b3161387 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 @@ -41,7 +41,7 @@ class SubmissionApiServiceSpec extends ApiServiceSpec with TableDrivenPropertyCh // increase the route timeout slightly for this test as the "large submission" tests sometimes // bump up against the default 5 second timeout. - implicit override val routeTestTimeout = RouteTestTimeout(30.seconds) + implicit override val routeTestTimeout: RouteTestTimeout = RouteTestTimeout(30.seconds) def withApiServices[T](dataSource: SlickDataSource)(testCode: TestApiService => T): T = { diff --git a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/WorkspaceApiLibraryPermissionsSpec.scala b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/WorkspaceApiLibraryPermissionsSpec.scala index 62d848ac7b..7012f6f7eb 100644 --- a/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/WorkspaceApiLibraryPermissionsSpec.scala +++ b/core/src/test/scala/org/broadinstitute/dsde/rawls/webservice/WorkspaceApiLibraryPermissionsSpec.scala @@ -122,7 +122,7 @@ class WorkspaceApiLibraryPermissionsSpec extends ApiServiceSpec { new MockGoogleServicesDAO("test"), new MockGooglePubSubDAO ) { - override val samDAO = new MockSamDAO(dataSource) { + override val samDAO = new MockSamDAO(this.dataSource) { override def userHasAction(resourceTypeName: SamResourceTypeName, resourceId: String, 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 57c9166da1..258ac6584d 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 @@ -106,7 +106,7 @@ class WorkspaceApiServiceSpec extends ApiServiceSpec { testCode: TestApiService => T ): T = { val apiService = new TestApiService(dataSource, user, new MockGoogleServicesDAO("test"), new MockGooglePubSubDAO) { - override val samDAO: MockSamDAO = new MockSamDAO(dataSource) { + override val samDAO: MockSamDAO = new MockSamDAO(this.dataSource) { override def userHasAction(resourceTypeName: SamResourceTypeName, resourceId: String, action: SamResourceAction, @@ -133,7 +133,7 @@ class WorkspaceApiServiceSpec extends ApiServiceSpec { // these need to be overridden to use the new samDAO override val rawlsWorkspaceAclManager = new RawlsWorkspaceAclManager(samDAO) override val multiCloudWorkspaceAclManager = - new MultiCloudWorkspaceAclManager(workspaceManagerDAO, samDAO, billingProfileManagerDAO, dataSource) + new MultiCloudWorkspaceAclManager(workspaceManagerDAO, samDAO, billingProfileManagerDAO, this.dataSource) } try testCode(apiService) 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 1d016a9bd0..6b0e9ad660 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 @@ -6,14 +6,8 @@ import akka.http.scaladsl.model.{StatusCode, StatusCodes} import akka.http.scaladsl.testkit.ScalatestRouteTest import bio.terra.profile.model.ProfileModel import bio.terra.workspace.client.ApiException -import bio.terra.workspace.model.{ - AzureContext, - GcpContext, - WorkspaceDescription, - WorkspaceStageModel, - WsmPolicyInput, - WsmPolicyPair -} +import bio.terra.workspace.model.{AzureContext, GcpContext, WorkspaceDescription, WorkspaceStageModel, WsmPolicyInput, WsmPolicyPair} +import cats.effect.IO import cats.implicits.catsSyntaxOptionId import com.google.api.client.googleapis.json.{GoogleJsonError, GoogleJsonResponseException} import com.google.api.client.http.{HttpHeaders, HttpResponseException} @@ -51,15 +45,9 @@ import org.broadinstitute.dsde.rawls.webservice._ import org.broadinstitute.dsde.rawls.{NoSuchWorkspaceException, RawlsExceptionWithErrorReport, RawlsTestUtils} import org.broadinstitute.dsde.workbench.dataaccess.{NotificationDAO, PubSubNotificationDAO} import org.broadinstitute.dsde.workbench.google.mock.{MockGoogleBigQueryDAO, MockGoogleIamDAO, MockGoogleStorageDAO} -import org.broadinstitute.dsde.workbench.model.google.{ - BigQueryDatasetName, - BigQueryTableName, - GcsBucketName, - GoogleProject, - IamPermission -} +import org.broadinstitute.dsde.workbench.model.google.{BigQueryDatasetName, BigQueryTableName, GcsBucketName, GoogleProject, IamPermission} import org.broadinstitute.dsde.workbench.model.{Notifications, WorkbenchEmail, WorkbenchGroupName} -import org.broadinstitute.dsde.workbench.openTelemetry.FakeOpenTelemetryMetricsInterpreter +import org.broadinstitute.dsde.workbench.openTelemetry.{FakeOpenTelemetryMetricsInterpreter, OpenTelemetryMetrics} import org.joda.time.DateTime import org.mockito.ArgumentMatchers._ import org.mockito.Mockito._ @@ -132,7 +120,7 @@ class WorkspaceServiceSpec with SubmissionApiService with MockUserInfoDirectivesWithUser { val ctx1 = RawlsRequestContext(UserInfo(user.userEmail, OAuth2BearerToken("foo"), 0, user.userSubjectId)) - implicit val openTelemetry = FakeOpenTelemetryMetricsInterpreter + implicit val openTelemetry: OpenTelemetryMetrics[IO] = FakeOpenTelemetryMetricsInterpreter lazy val workspaceService: WorkspaceService = workspaceServiceConstructor(ctx1) lazy val userService: UserService = userServiceConstructor(ctx1) 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 6d26b2ab8f..504f730b7c 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 @@ -6,6 +6,7 @@ import akka.testkit.TestKit import com.google.api.client.googleapis.json.GoogleJsonError.ErrorInfo import com.google.api.client.googleapis.json.{GoogleJsonError, GoogleJsonResponseException} import com.google.api.client.http._ +import nl.grons.metrics4.scala.Histogram import org.broadinstitute.dsde.rawls.metrics.StatsDTestUtils import org.broadinstitute.dsde.rawls.util.MockitoTestUtils import org.scalatest.BeforeAndAfterAll @@ -31,9 +32,9 @@ class GoogleUtilitiesSpec with Eventually with MockitoTestUtils with StatsDTestUtils { - implicit val executionContext = ExecutionContext.global - implicit def histo = ExpandedMetricBuilder.empty.asHistogram("histo") - implicit override val patienceConfig = PatienceConfig(scaled(Span(1000, Millis)), scaled(Span(15, Millis))) + implicit val executionContext: ExecutionContext = ExecutionContext.global + implicit def histo: Histogram = ExpandedMetricBuilder.empty.asHistogram("histo") + implicit override val patienceConfig: PatienceConfig = PatienceConfig(scaled(Span(1000, Millis)), scaled(Span(15, Millis))) override def afterAll() { TestKit.shutdownActorSystem(system) diff --git a/google/src/test/scala/org/broadinstitute/dsde/rawls/integrationtest/HttpGoogleAccessContextManagerDAOSpec.scala b/google/src/test/scala/org/broadinstitute/dsde/rawls/integrationtest/HttpGoogleAccessContextManagerDAOSpec.scala index 948b084e37..3f57abbf56 100644 --- a/google/src/test/scala/org/broadinstitute/dsde/rawls/integrationtest/HttpGoogleAccessContextManagerDAOSpec.scala +++ b/google/src/test/scala/org/broadinstitute/dsde/rawls/integrationtest/HttpGoogleAccessContextManagerDAOSpec.scala @@ -22,9 +22,9 @@ class HttpGoogleAccessContextManagerDAOSpec with MockitoTestUtils with StatsDTestUtils with ScalaFutures { - implicit val system = ActorSystem("HttpGoogleAccessContextManagerDAOSpec") + implicit val system: ActorSystem = ActorSystem("HttpGoogleAccessContextManagerDAOSpec") - implicit override val patienceConfig = PatienceConfig(timeout = scaled(Span(180, Seconds))) + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(180, Seconds))) // val etcConf = ConfigFactory.load() // val jenkinsConf = ConfigFactory.parseFile(new File("jenkins.conf")) // val gcsConfig = jenkinsConf.withFallback(etcConf).getConfig("gcs") 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 ba90b08b57..bea27bd17e 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 @@ -31,7 +31,7 @@ class HttpGooglePubSubDAOSpec with Eventually with MockitoTestUtils with StatsDTestUtils { - implicit val system = ActorSystem("HttpGooglePubSubDAOSpec") + implicit val system: ActorSystem = ActorSystem("HttpGooglePubSubDAOSpec") val etcConf = ConfigFactory.load() val jenkinsConf = ConfigFactory.parseFile(new File("jenkins.conf")) diff --git a/metrics/src/test/scala/org/broadinstitute/dsde/rawls/metrics/MetricsSpec.scala b/metrics/src/test/scala/org/broadinstitute/dsde/rawls/metrics/MetricsSpec.scala index 6e3c414117..194c7202ca 100644 --- a/metrics/src/test/scala/org/broadinstitute/dsde/rawls/metrics/MetricsSpec.scala +++ b/metrics/src/test/scala/org/broadinstitute/dsde/rawls/metrics/MetricsSpec.scala @@ -29,7 +29,7 @@ class MetricsSpec extends AnyFlatSpec with Matchers with BeforeAndAfter with Eve var reporter: StatsDReporter = _ var test: TestInstrumented = _ - implicit override val patienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) before { test = new TestInstrumented diff --git a/util/src/test/scala/org/broadinstitute/dsde/rawls/util/RetrySpec.scala b/util/src/test/scala/org/broadinstitute/dsde/rawls/util/RetrySpec.scala index fe3507bfaa..87b7a4ed46 100644 --- a/util/src/test/scala/org/broadinstitute/dsde/rawls/util/RetrySpec.scala +++ b/util/src/test/scala/org/broadinstitute/dsde/rawls/util/RetrySpec.scala @@ -32,7 +32,7 @@ class RetrySpec // This configures how long the calls to `whenReady(Future)` will wait for the Future // before giving up and failing the test. // See: http://doc.scalatest.org/2.2.4/index.html#org.scalatest.concurrent.Futures - implicit override val patienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) override def afterAll() { TestKit.shutdownActorSystem(system) diff --git a/util/src/test/scala/org/broadinstitute/dsde/rawls/util/ThresholdOneForOneStrategySpec.scala b/util/src/test/scala/org/broadinstitute/dsde/rawls/util/ThresholdOneForOneStrategySpec.scala index b27fcdf6fa..b1a61d81c0 100644 --- a/util/src/test/scala/org/broadinstitute/dsde/rawls/util/ThresholdOneForOneStrategySpec.scala +++ b/util/src/test/scala/org/broadinstitute/dsde/rawls/util/ThresholdOneForOneStrategySpec.scala @@ -26,7 +26,7 @@ class ThresholdOneForOneStrategySpec // This configures how long the calls to `whenReady(Future)` and `eventually` will wait // before giving up and failing the test. // See: http://doc.scalatest.org/2.2.4/index.html#org.scalatest.concurrent.Futures - implicit override val patienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) + implicit override val patienceConfig: PatienceConfig = PatienceConfig(timeout = scaled(Span(10, Seconds))) val alwaysRestart: PartialFunction[Throwable, Directive] = { case _ => Restart