mirror of https://github.com/databricks/cli.git
rename
This commit is contained in:
parent
92f8a68043
commit
51ba689a99
|
@ -17,7 +17,7 @@ const CAN_MANAGE = "CAN_MANAGE"
|
||||||
const CAN_VIEW = "CAN_VIEW"
|
const CAN_VIEW = "CAN_VIEW"
|
||||||
const CAN_RUN = "CAN_RUN"
|
const CAN_RUN = "CAN_RUN"
|
||||||
|
|
||||||
var notSupportedResources = []string{"clusters", "volumes", "schemas", "quality_monitors", "registered_models"}
|
var unsupportedResources = []string{"clusters", "volumes", "schemas", "quality_monitors", "registered_models"}
|
||||||
|
|
||||||
var allowedLevels = []string{CAN_MANAGE, CAN_VIEW, CAN_RUN}
|
var allowedLevels = []string{CAN_MANAGE, CAN_VIEW, CAN_RUN}
|
||||||
var levelsMap = map[string](map[string]string){
|
var levelsMap = map[string](map[string]string){
|
||||||
|
|
|
@ -162,15 +162,15 @@ func TestWarningOnOverlapPermission(t *testing.T) {
|
||||||
func TestAllResourcesExplicitlyDefinedForPermissionsSupport(t *testing.T) {
|
func TestAllResourcesExplicitlyDefinedForPermissionsSupport(t *testing.T) {
|
||||||
r := config.Resources{}
|
r := config.Resources{}
|
||||||
|
|
||||||
for _, resource := range notSupportedResources {
|
for _, resource := range unsupportedResources {
|
||||||
_, ok := levelsMap[resource]
|
_, ok := levelsMap[resource]
|
||||||
assert.False(t, ok, fmt.Sprintf("Resource %s is defined in both levelsMap and notSupportedResources", resource))
|
assert.False(t, ok, fmt.Sprintf("Resource %s is defined in both levelsMap and unsupportedResources", resource))
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, resource := range r.AllResources() {
|
for _, resource := range r.AllResources() {
|
||||||
_, ok := levelsMap[resource.Description.PluralName]
|
_, ok := levelsMap[resource.Description.PluralName]
|
||||||
if !slices.Contains(notSupportedResources, resource.Description.PluralName) && !ok {
|
if !slices.Contains(unsupportedResources, resource.Description.PluralName) && !ok {
|
||||||
assert.Fail(t, fmt.Sprintf("Resource %s is not explicitly defined in levelsMap or notSupportedResources", resource.Description.PluralName))
|
assert.Fail(t, fmt.Sprintf("Resource %s is not explicitly defined in levelsMap or unsupportedResources", resource.Description.PluralName))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue