diff --git a/pkg/scheduler/placement/filter_test.go b/pkg/scheduler/placement/filter_test.go index 99afc9bb1..0e5d77f48 100644 --- a/pkg/scheduler/placement/filter_test.go +++ b/pkg/scheduler/placement/filter_test.go @@ -144,6 +144,17 @@ func TestNewFilterExpressions(t *testing.T) { if filter.empty { t.Error("filter create did not set empty flag correctly") } + + // test invalid regexp format + conf.Users = []string{"user[a-z"} + conf.Groups = []string{"group[a-z"} + filter = newFilter(conf) + if filter.userExp != nil { + t.Error("The userExp should be nil for an invalid regexp format.") + } + if filter.groupExp != nil { + t.Error("The groupExp should be nil for an invalid regexp format.") + } } // New filter creation failure tests diff --git a/pkg/scheduler/ugm/manager_test.go b/pkg/scheduler/ugm/manager_test.go index 9c571be96..040602a7e 100644 --- a/pkg/scheduler/ugm/manager_test.go +++ b/pkg/scheduler/ugm/manager_test.go @@ -238,7 +238,7 @@ func TestAddRemoveUserAndGroups(t *testing.T) { manager.DecreaseTrackedResource(queuePath1, TestApp1, usage3, user, true) assert.Equal(t, 1, len(manager.GetUsersResources()), "userTrackers count should be 1") - assert.Equal(t, 0, len(manager.GetGroupsResources()), "groupTrackers count should be 1") + assert.Equal(t, 0, len(manager.GetGroupsResources()), "groupTrackers count should be 0") manager.DecreaseTrackedResource(queuePath2, TestApp2, usage2, user1, true) assert.Equal(t, 0, len(manager.GetUsersResources()), "userTrackers count should be 0")