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-k8shim.git


The following commit(s) were added to refs/heads/master by this push:
     new c5f40745 [YUNIKORN-2786] Improve convert2Namespace funtion's test 
coverage (#887)
c5f40745 is described below

commit c5f40745908c2f6492ad3ef1024471a23c7bdb01
Author: SP12893678 <[email protected]>
AuthorDate: Thu Aug 8 22:42:51 2024 +0800

    [YUNIKORN-2786] Improve convert2Namespace funtion's test coverage (#887)
    
    ==> body-pr-887-temp <==
    [YUNIKORN-2786] Improve convert2Namespace funtion's test coverage
    code review
    
    Closes: #887
    
    Signed-off-by: Kuan-Po Tseng <[email protected]>
---
 pkg/admission/util_test.go | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/pkg/admission/util_test.go b/pkg/admission/util_test.go
index d34a952a..bcfe41b2 100644
--- a/pkg/admission/util_test.go
+++ b/pkg/admission/util_test.go
@@ -19,6 +19,7 @@
 package admission
 
 import (
+       "reflect"
        "strings"
        "testing"
 
@@ -189,3 +190,18 @@ func TestDefaultQueueName(t *testing.T) {
                t.Fatal("UpdatePodLabelForAdmissionController is not as 
expected")
        }
 }
+
+func TestConvert2Namespace(t *testing.T) {
+       namespace := &v1.Namespace{}
+       result := convert2Namespace(namespace)
+       assert.Check(t, result != nil)
+       assert.Check(t, reflect.DeepEqual(result, namespace))
+
+       obj := struct{}{}
+       result = convert2Namespace(obj)
+       assert.Check(t, result == nil)
+
+       pod := &v1.Pod{}
+       result = convert2Namespace(pod)
+       assert.Check(t, result == nil)
+}


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

Reply via email to