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

brandboat 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 e2fa77c3 [YUNIKORN-2482] Failure to set template does not return error 
(#848)
e2fa77c3 is described below

commit e2fa77c3c43c617c48124172d059c84b8e0adec7
Author: Ryan <[email protected]>
AuthorDate: Mon Apr 22 11:49:08 2024 +0800

    [YUNIKORN-2482] Failure to set template does not return error (#848)
    
    Closes: #848
    
    Signed-off-by: Kuan-Po Tseng <[email protected]>
---
 pkg/scheduler/objects/queue.go      |  2 +-
 pkg/scheduler/objects/queue_test.go | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/pkg/scheduler/objects/queue.go b/pkg/scheduler/objects/queue.go
index 3de469a4..c231f8cf 100644
--- a/pkg/scheduler/objects/queue.go
+++ b/pkg/scheduler/objects/queue.go
@@ -351,7 +351,7 @@ func (sq *Queue) applyConf(conf configs.QueueConfig) error {
 
        if !sq.isLeaf {
                if err = sq.setTemplate(conf.ChildTemplate); err != nil {
-                       return nil
+                       return err
                }
        }
 
diff --git a/pkg/scheduler/objects/queue_test.go 
b/pkg/scheduler/objects/queue_test.go
index 46e8f749..0ff14212 100644
--- a/pkg/scheduler/objects/queue_test.go
+++ b/pkg/scheduler/objects/queue_test.go
@@ -2062,6 +2062,18 @@ func TestApplyConf(t *testing.T) {
        err = errQueue.ApplyConf(errConf2)
        assert.ErrorContains(t, err, "multiple spaces found in ACL")
 
+       // wrong ChildTemplate
+       errConf3 := configs.QueueConfig{
+               Parent: true,
+               ChildTemplate: configs.ChildTemplate{
+                       Resources: configs.Resources{
+                               Guaranteed: map[string]string{"wrong template": 
"-100"},
+                       },
+               },
+       }
+       err = errQueue.ApplyConf(errConf3)
+       assert.ErrorContains(t, err, "invalid quantity")
+
        // isManaged is changed from unmanaged to managed
        childConf := configs.QueueConfig{}
 


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

Reply via email to