Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WOR-1348] Fix GCP Enhanced Bucket Monitoring on Clone #2654

Merged
merged 4 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1128,8 +1128,8 @@ class WorkspaceService(protected val ctx: RawlsRequestContext,
newAttrs = sourceWorkspaceContext.attributes ++ destWorkspaceRequest.attributes
destWorkspaceContext <- traceDBIOWithParent("createNewWorkspaceContext (cloneWorkspace)", ctx) { s =>
val forceEnhancedBucketMonitoring =
destWorkspaceRequest.enhancedBucketLogging.exists(identity) || sourceBucketNameOption.exists(
_.startsWith(s"${config.workspaceBucketNamePrefix}-secure")
destWorkspaceRequest.enhancedBucketLogging.exists(identity) || sourceWorkspace.bucketName.startsWith(
s"${config.workspaceBucketNamePrefix}-secure"
)
createNewWorkspaceContext(
destWorkspaceRequest.copy(authorizationDomain = Option(newAuthDomain),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2718,6 +2718,32 @@ class WorkspaceServiceSpec
workspace.bucketName should startWith(s"${services.workspaceServiceConfig.workspaceBucketNamePrefix}-secure")
}

it should "clone a workspace with an enhanced bucket monitoring, resulting in the child workspace having enhanced logging even if the destination bucket location is defined" in withTestDataServices {
services =>
val baseWorkspaceName = "secure_space_for_workin"
val baseWorkspaceRequest = WorkspaceRequest(
testData.testProject1Name.value,
baseWorkspaceName,
Map.empty,
enhancedBucketLogging = Some(true)
)
val baseWorkspace = Await.result(services.workspaceService.createWorkspace(baseWorkspaceRequest), Duration.Inf)

val newWorkspaceName = "cloned_space"
val workspaceRequest =
WorkspaceRequest(testData.testProject1Name.value, newWorkspaceName, Map.empty, bucketLocation = Some("US"))

val workspace =
Await.result(services.mcWorkspaceService.cloneMultiCloudWorkspace(services.workspaceService,
baseWorkspace.toWorkspaceName,
workspaceRequest
),
Duration.Inf
)

workspace.bucketName should startWith(s"${services.workspaceServiceConfig.workspaceBucketNamePrefix}-secure")
}

it should "create a bucket with enhanced logging when told to, even if the parent workspace doesn't have it" in withTestDataServices {
services =>
val baseWorkspaceName = "secure_space_for_workin"
Expand Down
Loading