test(clusters): add permissions tests on cluster resources

This commit is contained in:
Mike-F-G 2024-10-29 14:38:06 +01:00
parent 16e2ceeefa
commit 6057cdc451
1 changed files with 8 additions and 0 deletions

View File

@ -51,6 +51,9 @@ func TestApplyBundlePermissions(t *testing.T) {
"endpoint_1": {},
"endpoint_2": {},
},
Clusters: map[string]*resources.Cluster{
"cluster_1": {},
},
},
},
}
@ -103,6 +106,11 @@ func TestApplyBundlePermissions(t *testing.T) {
require.Contains(t, b.Config.Resources.ModelServingEndpoints["endpoint_2"].Permissions, resources.Permission{Level: "CAN_MANAGE", UserName: "TestUser"})
require.Contains(t, b.Config.Resources.ModelServingEndpoints["endpoint_2"].Permissions, resources.Permission{Level: "CAN_VIEW", GroupName: "TestGroup"})
require.Contains(t, b.Config.Resources.ModelServingEndpoints["endpoint_2"].Permissions, resources.Permission{Level: "CAN_QUERY", ServicePrincipalName: "TestServicePrincipal"})
require.Len(t, b.Config.Resources.Clusters["cluster_1"].Permissions, 3)
require.Contains(t, b.Config.Resources.Clusters["cluster_1"].Permissions, resources.Permission{Level: "CAN_MANAGE", UserName: "TestUser"})
require.Contains(t, b.Config.Resources.Clusters["cluster_1"].Permissions, resources.Permission{Level: "CAN_RESTART", GroupName: "TestGroup"})
require.Contains(t, b.Config.Resources.Clusters["cluster_1"].Permissions, resources.Permission{Level: "CAN_ATTACH_TO", ServicePrincipalName: "TestServicePrincipal"})
}
func TestWarningOnOverlapPermission(t *testing.T) {