Skip to content

Commit

Permalink
Merge branch 'develop' into update/billing-profile-manager-client-jav…
Browse files Browse the repository at this point in the history
…ax-0.1.502-SNAPSHOT
  • Loading branch information
calypsomatic authored Jan 23, 2024
2 parents 77a0e54 + 538109f commit 94f2332
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import scala.concurrent.{Await, Future}
import scala.language.postfixOps
import org.broadinstitute.dsde.test.pipeline._

import scala.util.{Failure, Try}

@WorkspacesAzureTest
class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAfterAll with CleanUp {
// The values of the following vars are injected from the pipeline.
Expand Down Expand Up @@ -58,11 +60,20 @@ class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAft
}
}

def logFailure[T](message: String)(fun: => T): T =
try {
fun
} catch {
case e: Throwable =>
logger.info(message)
throw e
}

"Other Terra services" should "include Leonardo" in {
implicit val token = ownerAuthToken
val statusRequest = Rawls.getRequest(leoUrl + "status")

withClue(s"Leo status API returned ${statusRequest.status.intValue()} ${statusRequest.status.reason()}!") {
logFailure(s"Leo status API returned ${statusRequest.status.intValue()} ${statusRequest.status.reason()}!") {
statusRequest.status shouldBe StatusCodes.OK
}
}
Expand All @@ -71,7 +82,7 @@ class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAft
implicit val token = ownerAuthToken
val statusRequest = Rawls.getRequest(wsmUrl + "status")

withClue(s"WSM status API returned ${statusRequest.status.intValue()} ${statusRequest.status.reason()}!") {
logFailure(s"WSM status API returned ${statusRequest.status.intValue()} ${statusRequest.status.reason()}!") {
statusRequest.status shouldBe StatusCodes.OK
}
}
Expand Down Expand Up @@ -123,14 +134,14 @@ class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAft
// Upload the blob that will be cloned
uploadBlob(sasUrl, analysesFilename, analysesContents)
val downloadContents = downloadBlob(sasUrl, analysesFilename)
withClue(s"testing uploaded blob ${analysesFilename}") {
logFailure(s"testing uploaded blob ${analysesFilename}") {
downloadContents shouldBe analysesContents
}

// Upload the blob that should not be cloned
uploadBlob(sasUrl, nonAnalysesFilename, nonAnalysesContents)
val downloadNonAnalysesContents = downloadBlob(sasUrl, nonAnalysesFilename)
withClue(s"testing uploaded blob ${nonAnalysesFilename}") {
logFailure(s"testing uploaded blob ${nonAnalysesFilename}") {
downloadNonAnalysesContents shouldBe nonAnalysesContents
}

Expand All @@ -150,7 +161,7 @@ class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAft
clonedResponse.workspace.workspaceType should be(Some(WorkspaceType.McWorkspace))
clonedResponse.accessLevel should be(Some(ProjectOwner))

withClue(s"Verifying container cloning has completed") {
logFailure(s"Verifying container cloning has completed") {
awaitCond(
isCloneCompleted(projectName, workspaceCloneName),
60 seconds,
Expand All @@ -160,19 +171,19 @@ class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAft

val cloneSasUrl = getSasUrl(projectName, workspaceCloneName, token)
val downloadCloneContents = downloadBlob(cloneSasUrl, analysesFilename)
withClue(s"testing blob ${analysesFilename} cloned") {
logFailure(s"testing blob ${analysesFilename} cloned") {
downloadCloneContents shouldBe analysesContents
}
withClue(s"testing blob ${nonAnalysesFilename} did not clone") {
logFailure(s"testing blob ${nonAnalysesFilename} did not clone") {
verifyBlobNotCloned(cloneSasUrl, nonAnalysesFilename)
}
} finally
withClue(s"deleting the cloned workspace ${workspaceCloneName} failed") {
logFailure(s"deleting the cloned workspace ${workspaceCloneName} failed") {
Rawls.workspaces.delete(projectName, workspaceCloneName)
assertNoAccessToWorkspace(projectName, workspaceCloneName)
}
} finally
withClue(s"deleting the original workspace ${workspaceName} failed") {
logFailure(s"deleting the original workspace ${workspaceName} failed") {
Rawls.workspaces.delete(projectName, workspaceName)
assertNoAccessToWorkspace(projectName, workspaceName)
}
Expand Down Expand Up @@ -276,9 +287,9 @@ class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAft
response.workspace.name should be(workspaceName)
response.workspace.cloudPlatform should be(Some(WorkspaceCloudPlatform.Azure))
val workspaceId = response.workspace.workspaceId
val creationTimeout = 600
val creationTimeout = 900

withClue(s"WDS did not become deletable within the timeout period of ${creationTimeout} seconds") {
logFailure(s"WDS did not become deletable within the timeout period of ${creationTimeout} seconds") {
awaitCond(
isWdsDeletable(workspaceId, token),
creationTimeout seconds,
Expand Down Expand Up @@ -338,14 +349,14 @@ class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAft
HttpRequest(HttpMethods.PUT, fullBlobUrl, headers, HttpEntity(ContentTypes.`text/plain(UTF-8)`, contents))
val uploadResponse = Await.result(Http().singleRequest(uploadRequest), 2.minutes)

withClue(s"Upload blob ${blobName}") {
logFailure(s"Upload blob ${blobName}") {
uploadResponse.status shouldBe StatusCodes.Created
}
}

private def downloadBlob(containerUrl: String, blobName: String): String = {
val downloadResponse = getBlobResponse(containerUrl, blobName)
withClue(s"Download blob ${blobName}") {
logFailure(s"Download blob ${blobName}") {
downloadResponse.status shouldBe StatusCodes.OK
}
val byteStringSink: Sink[ByteString, Future[ByteString]] = Sink.fold(ByteString("")) { (z, i) =>
Expand All @@ -357,7 +368,7 @@ class WorkspacesAzureApiSpec extends AnyFlatSpec with Matchers with BeforeAndAft

private def verifyBlobNotCloned(containerUrl: String, blobName: String): Unit = {
val downloadResponse = getBlobResponse(containerUrl, blobName)
withClue(s"Check blob ${blobName} does not exist") {
logFailure(s"Check blob ${blobName} does not exist") {
downloadResponse.status shouldBe StatusCodes.NotFound
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,12 @@ class EntityServiceSpec
val entityQuery = EntityQuery(1, pageSize, "name", SortDirections.Ascending, None)
val ex = intercept[RawlsExceptionWithErrorReport] {
Await.result(
services.entityService.queryEntitiesSource(testData.wsName, None, testData.sample1.entityType, entityQuery, None),
services.entityService.queryEntitiesSource(testData.wsName,
None,
testData.sample1.entityType,
entityQuery,
None
),
waitDuration
)
}
Expand Down
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object Dependencies {
val jodaTime: ModuleID = "joda-time" % "joda-time" % "2.12.6"
val jodaConvert: ModuleID = "org.joda" % "joda-convert" % "2.2.3"
val typesafeConfig: ModuleID = "com.typesafe" % "config" % "1.4.3"
val sentryLogback: ModuleID = "io.sentry" % "sentry-logback" % "7.1.0"
val sentryLogback: ModuleID = "io.sentry" % "sentry-logback" % "7.2.0"
val webjarsLocator: ModuleID = "org.webjars" % "webjars-locator" % "0.50"
val commonsJEXL: ModuleID = "org.apache.commons" % "commons-jexl" % "2.1.1"
val cats: ModuleID = "org.typelevel" %% "cats-core" % "2.10.0"
Expand Down Expand Up @@ -105,7 +105,7 @@ object Dependencies {
val workbenchOpenTelemetry: ModuleID = "org.broadinstitute.dsde.workbench" %% "workbench-opentelemetry" % workbenchOpenTelemetryV
val workbenchOpenTelemetryTests: ModuleID = "org.broadinstitute.dsde.workbench" %% "workbench-opentelemetry" % workbenchOpenTelemetryV classifier "tests"

val googleStorageLocal: ModuleID = "com.google.cloud" % "google-cloud-nio" % "0.127.8" % "test"
val googleStorageLocal: ModuleID = "com.google.cloud" % "google-cloud-nio" % "0.127.9" % "test"

val workbenchUtil: ModuleID = "org.broadinstitute.dsde.workbench" %% "workbench-util" % s"0.10-${workbenchLibsHash}"

Expand Down

0 comments on commit 94f2332

Please sign in to comment.