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

mani 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 93e70526 [YUNIKORN-2136] change IsZero to StrictlyGreaterThanZero 
(#712)
93e70526 is described below

commit 93e70526d9f46c420ed00e08f298e9c301f1764c
Author: PoAn Yang <[email protected]>
AuthorDate: Wed Nov 15 13:55:09 2023 +0530

    [YUNIKORN-2136] change IsZero to StrictlyGreaterThanZero (#712)
    
    Closes: #712
    
    Signed-off-by: Manikandan R <[email protected]>
---
 pkg/common/configs/configvalidator.go      | 4 ++--
 pkg/common/configs/configvalidator_test.go | 2 +-
 pkg/webservice/handlers_test.go            | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkg/common/configs/configvalidator.go 
b/pkg/common/configs/configvalidator.go
index e2aa56d6..bd12d535 100644
--- a/pkg/common/configs/configvalidator.go
+++ b/pkg/common/configs/configvalidator.go
@@ -530,8 +530,8 @@ func checkLimit(limit Limit, existedUserName 
map[string]bool, existedGroupName m
                                zap.Error(err))
                        return err
                }
-               if resources.IsZero(limitResource) {
-                       return fmt.Errorf("MaxResources is zero in '%s' limit, 
all resource types are zero", limit.Limit)
+               if !resources.StrictlyGreaterThanZero(limitResource) {
+                       return fmt.Errorf("MaxResources should be greater than 
zero in '%s' limit", limit.Limit)
                }
        }
        // at least some resource should be not null
diff --git a/pkg/common/configs/configvalidator_test.go 
b/pkg/common/configs/configvalidator_test.go
index bd9b17f3..6a87f933 100644
--- a/pkg/common/configs/configvalidator_test.go
+++ b/pkg/common/configs/configvalidator_test.go
@@ -1142,7 +1142,7 @@ func TestCheckLimits(t *testing.T) { //nolint:funlen
                                        },
                                },
                        },
-                       errMsg: "MaxResources is zero",
+                       errMsg: "MaxResources should be greater than zero",
                },
                {
                        name: "both maxresources and maxresources are 0",
diff --git a/pkg/webservice/handlers_test.go b/pkg/webservice/handlers_test.go
index 91827442..cd8960f5 100644
--- a/pkg/webservice/handlers_test.go
+++ b/pkg/webservice/handlers_test.go
@@ -347,7 +347,7 @@ func TestUserGroupLimits(t *testing.T) {
                        content: userGroupLimitsInvalidConfig,
                        expectedResponse: dao.ValidateConfResponse{
                                Allowed: false,
-                               Reason:  "MaxResources is zero in '' limit, all 
resource types are zero",
+                               Reason:  "MaxResources should be greater than 
zero in '' limit",
                        },
                },
                {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to