This commit is contained in:
Andrew Nester 2024-12-09 15:18:05 +01:00
parent 92f8a68043
commit 51ba689a99
No known key found for this signature in database
GPG Key ID: 12BC628A44B7DA57
2 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ const CAN_MANAGE = "CAN_MANAGE"
const CAN_VIEW = "CAN_VIEW"
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 levelsMap = map[string](map[string]string){

View File

@ -162,15 +162,15 @@ func TestWarningOnOverlapPermission(t *testing.T) {
func TestAllResourcesExplicitlyDefinedForPermissionsSupport(t *testing.T) {
r := config.Resources{}
for _, resource := range notSupportedResources {
for _, resource := range unsupportedResources {
_, 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() {
_, ok := levelsMap[resource.Description.PluralName]
if !slices.Contains(notSupportedResources, resource.Description.PluralName) && !ok {
assert.Fail(t, fmt.Sprintf("Resource %s is not explicitly defined in levelsMap or notSupportedResources", resource.Description.PluralName))
if !slices.Contains(unsupportedResources, resource.Description.PluralName) && !ok {
assert.Fail(t, fmt.Sprintf("Resource %s is not explicitly defined in levelsMap or unsupportedResources", resource.Description.PluralName))
}
}
}