This is an automated email from the ASF dual-hosted git repository.
zhuqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git
The following commit(s) were added to refs/heads/master by this push:
new ff42fe0e [YUNIKORN-1950] Improving test coverage for user/group limit
(#747)
ff42fe0e is described below
commit ff42fe0ed81ad2ca251809eb920d360c3f662731
Author: DouPache <[email protected]>
AuthorDate: Sat Dec 9 15:48:27 2023 +0800
[YUNIKORN-1950] Improving test coverage for user/group limit (#747)
Closes: #747
Signed-off-by: qzhu <[email protected]>
---
pkg/scheduler/ugm/manager_test.go | 170 ++++++++++++++++++++++++++++++++++++++
1 file changed, 170 insertions(+)
diff --git a/pkg/scheduler/ugm/manager_test.go
b/pkg/scheduler/ugm/manager_test.go
index 53840b0a..2a2044ee 100644
--- a/pkg/scheduler/ugm/manager_test.go
+++ b/pkg/scheduler/ugm/manager_test.go
@@ -1123,7 +1123,32 @@ func TestUserGroupLimitChange(t *testing.T) {
//nolint:funlen
limits []configs.Limit
newLimits []configs.Limit
}{
+ // user limit only
{
+
+ name: "maxresources with an updated specific user
limit",
+ user: security.UserGroup{User: "user1", Groups:
[]string{"group1"}},
+ limits: []configs.Limit{
+ createLimit([]string{"user1"}, nil,
largeResource, 2),
+ },
+ newLimits: []configs.Limit{
+ createLimit([]string{"user1"}, nil,
mediumResource, 2),
+ },
+ },
+ {
+ name: "maxapplications with an updated specific user
limit",
+ user: security.UserGroup{User: "user1", Groups:
[]string{"group1"}},
+ limits: []configs.Limit{
+ createLimit([]string{"user1"}, nil,
largeResource, 2),
+ },
+ newLimits: []configs.Limit{
+ createLimit([]string{"user1"}, nil,
largeResource, 1),
+ },
+ },
+
+ // group limit only
+ {
+
name: "maxresources with an updated specific group
limit",
user: security.UserGroup{User: "user1", Groups:
[]string{"group1"}},
limits: []configs.Limit{
@@ -1133,6 +1158,151 @@ func TestUserGroupLimitChange(t *testing.T) {
//nolint:funlen
createLimit(nil, []string{"group1"},
mediumResource, 2),
},
},
+ {
+ name: "maxapplications with an updated specific group
limit",
+ user: security.UserGroup{User: "user1", Groups:
[]string{"group1"}},
+ limits: []configs.Limit{
+ createLimit(nil, []string{"group1"},
largeResource, 2),
+ },
+ newLimits: []configs.Limit{
+ createLimit(nil, []string{"group1"},
largeResource, 1),
+ },
+ },
+
+ // user wilcard limit
+ {
+ name: "maxresources with an updated wildcard user
limit",
+ user: security.UserGroup{User: "user2", Groups:
[]string{"group2"}},
+ limits: []configs.Limit{
+ createLimit([]string{"user1"}, nil,
tinyResource, 2),
+ createLimit([]string{"*"}, nil, largeResource,
2),
+ },
+ newLimits: []configs.Limit{
+ createLimit([]string{"user1"}, nil,
largeResource, 2),
+ createLimit([]string{"*"}, nil, mediumResource,
2),
+ },
+ },
+ {
+ name: "maxapplications with an updated wildcard user
limit",
+ user: security.UserGroup{User: "user2", Groups:
[]string{"group2"}},
+ limits: []configs.Limit{
+ createLimit([]string{"user1"}, nil,
tinyResource, 1),
+ createLimit([]string{"*"}, nil, largeResource,
2),
+ },
+ newLimits: []configs.Limit{
+ createLimit([]string{"user1"}, nil,
largeResource, 2),
+ createLimit([]string{"*"}, nil, largeResource,
1),
+ },
+ },
+
+ // group wilcard limit
+ {
+
+ name: "maxresources with an updated wildcard group
limit",
+ user: security.UserGroup{User: "user2", Groups:
[]string{"group2"}},
+ limits: []configs.Limit{
+ createLimit(nil, []string{"group1"},
tinyResource, 2),
+ createLimit(nil, []string{"*"}, largeResource,
2),
+ },
+ newLimits: []configs.Limit{
+ createLimit(nil, []string{"group1"},
largeResource, 2),
+ createLimit(nil, []string{"*"}, mediumResource,
2),
+ },
+ },
+ {
+ name: "maxapplications with an updated wildcard group
limit",
+ user: security.UserGroup{User: "user2", Groups:
[]string{"group2"}},
+ limits: []configs.Limit{
+ createLimit(nil, []string{"group1"},
tinyResource, 1),
+ createLimit(nil, []string{"*"}, largeResource,
2),
+ },
+ newLimits: []configs.Limit{
+ createLimit(nil, []string{"group1"},
largeResource, 2),
+ createLimit(nil, []string{"*"}, largeResource,
1),
+ },
+ },
+
+ // in a different limit
+ {
+ name: "maxresources with a new specific user limit",
+ user: security.UserGroup{User: "user1", Groups:
[]string{"group1"}},
+ limits: []configs.Limit{
+ {
+ Limit: "parent queue limit
for specific user",
+ Users: []string{"user1"},
+ MaxResources:
map[string]string{"memory": "100", "vcores": "100"},
+ MaxApplications: 2,
+ },
+ },
+ newLimits: []configs.Limit{
+ {
+ Limit: "new parent queue
limit for specific user",
+ Users: []string{"user1"},
+ MaxResources:
map[string]string{"memory": "50", "vcores": "50"},
+ MaxApplications: 2,
+ },
+ },
+ },
+ {
+ name: "maxapplications with a new specific user limit",
+ user: security.UserGroup{User: "user1", Groups:
[]string{"group1"}},
+ limits: []configs.Limit{
+ {
+ Limit: "parent queue limit
for specific user",
+ Users: []string{"user1"},
+ MaxResources:
map[string]string{"memory": "100", "vcores": "100"},
+ MaxApplications: 2,
+ },
+ },
+ newLimits: []configs.Limit{
+ {
+ Limit: "new parent queue
limit for specific user",
+ Users: []string{"user1"},
+ MaxResources:
map[string]string{"memory": "100", "vcores": "100"},
+ MaxApplications: 1,
+ },
+ },
+ },
+ {
+ name: "maxresources with a new specific group limit",
+ user: security.UserGroup{User: "user1", Groups:
[]string{"group1"}},
+ limits: []configs.Limit{
+ {
+ Limit: "parent queue limit
for specific group",
+ Groups: []string{"group1"},
+ MaxResources:
map[string]string{"memory": "100", "vcores": "100"},
+ MaxApplications: 2,
+ },
+ },
+ newLimits: []configs.Limit{
+ {
+ Limit: "new parent queue
limit for specific group",
+ Groups: []string{"group1"},
+ MaxResources:
map[string]string{"memory": "50", "vcores": "50"},
+ MaxApplications: 2,
+ },
+ },
+ },
+ {
+ name: "maxapplications with a new specific group limit",
+ user: security.UserGroup{User: "user1", Groups:
[]string{"group1"}},
+ limits: []configs.Limit{
+ {
+ Limit: "parent queue limit
for specific group",
+ Groups: []string{"group1"},
+ MaxResources:
map[string]string{"memory": "100", "vcores": "100"},
+ MaxApplications: 2,
+ },
+ },
+ newLimits: []configs.Limit{
+ {
+ Limit: "new parent queue
limit for specific group",
+ Groups: []string{"group1"},
+ MaxResources:
map[string]string{"memory": "100", "vcores": "100"},
+ MaxApplications: 1,
+ },
+ },
+ },
}
for _, tc := range testCases {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]