Skip to content

Commit

Permalink
[YUNIKORN-2673] Improve newFilter funtion's test coverage (#893)
Browse files Browse the repository at this point in the history
Closes: #893

Signed-off-by: Peter Bacsko <pbacsko@cloudera.com>
  • Loading branch information
SP12893678 authored and pbacsko committed Jun 18, 2024
1 parent a786feb commit 5706b54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions pkg/scheduler/placement/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/ugm/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 5706b54

Please sign in to comment.