This is an automated email from the ASF dual-hosted git repository.

pbacsko 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 5706b54b [YUNIKORN-2673] Improve newFilter funtion's test coverage 
(#893)
5706b54b is described below

commit 5706b54b049c3da10551a44e36658c62e8b6a184
Author: SP12893678 <36910625+sp12893...@users.noreply.github.com>
AuthorDate: Tue Jun 18 15:38:43 2024 +0200

    [YUNIKORN-2673] Improve newFilter funtion's test coverage (#893)
    
    Closes: #893
    
    Signed-off-by: Peter Bacsko <pbac...@cloudera.com>
---
 pkg/scheduler/placement/filter_test.go | 11 +++++++++++
 pkg/scheduler/ugm/manager_test.go      |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/pkg/scheduler/placement/filter_test.go 
b/pkg/scheduler/placement/filter_test.go
index 99afc9bb..0e5d77f4 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 9c571be9..040602a7 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")


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@yunikorn.apache.org
For additional commands, e-mail: issues-h...@yunikorn.apache.org

Reply via email to