Skip to content

Commit

Permalink
Format and add integration test for vector_search_endpoint support in…
Browse files Browse the repository at this point in the history
… databricks_permissions
  • Loading branch information
zgcalebp committed Nov 12, 2024
1 parent ad76876 commit f68d0e4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions internal/acceptance/permissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,27 @@ func TestAccPermissions_ServingEndpoint(t *testing.T) {
})
}

func TestAccPermissions_VectorSearchEndpoint(t *testing.T) {
loadDebugEnvIfRunsFromIDE(t, "workspace")
if isGcp(t) {
skipf(t)("Vector Search endpoints are not supported on GCP")
}
endpointTemplate := `

Check failure on line 874 in internal/acceptance/permissions_test.go

View workflow job for this annotation

GitHub Actions / tests

endpointTemplate declared and not used
resource "databricks_vector_search_endpoint" "endpoint" {
name = "{var.STICKY_RANDOM}"
endpoint_type = "STANDARD"
}
`
WorkspaceLevel(t, Step{
Template: experimentTemplate + makePermissionsTestStage("vector_search_endpoint_id", "databricks_vector_search_endpoint.endpoint.endpoint_id", groupPermissions("CAN_USE")),

Check failure on line 881 in internal/acceptance/permissions_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: experimentTemplate
}, Step{
Template: experimentTemplate + makePermissionsTestStage("vector_search_endpoint_id", "databricks_vector_search_endpoint.endpoint.endpoint_id", currentPrincipalPermission(t, "CAN_MANAGE"), groupPermissions("CAN_MANAGE")),

Check failure on line 883 in internal/acceptance/permissions_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: experimentTemplate
}, Step{
Template: experimentTemplate + makePermissionsTestStage("vector_search_endpoint_id", "databricks_vector_search_endpoint.endpoint.endpoint_id", currentPrincipalPermission(t, "CAN_USE"), groupPermissions("CAN_MANAGE")),

Check failure on line 885 in internal/acceptance/permissions_test.go

View workflow job for this annotation

GitHub Actions / tests

undefined: experimentTemplate (compile)
ExpectError: regexp.MustCompile("cannot remove management permissions for the current user for mlflowExperiment, allowed levels: CAN_MANAGE"),
})
}

func TestAccPermissions_Alert(t *testing.T) {
loadDebugEnvIfRunsFromIDE(t, "workspace")
alertTemplate := `
Expand Down
2 changes: 1 addition & 1 deletion permissions/permission_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ func allResourcePermissions() []resourcePermissions {
objectType: "vector-search-endpoint",
requestObjectType: "vector-search-endpoints",
allowedPermissionLevels: map[string]permissionLevelOptions{
"CAN_USE": {isManagementPermission: false},
"CAN_USE": {isManagementPermission: false},
"CAN_MANAGE": {isManagementPermission: true},
},
updateAclCustomizers: []update.ACLCustomizer{update.AddCurrentUserAsManage},
Expand Down

0 comments on commit f68d0e4

Please sign in to comment.