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

chenyulin0719 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 9b9534cb [YUNIKORN-3064] Refactor user_group_limit E2E test suite 
structure (#972)
9b9534cb is described below

commit 9b9534cb3d3323588967c399e1db6771de025ffd
Author: Michael Chu <[email protected]>
AuthorDate: Tue May 6 13:38:52 2025 +0000

    [YUNIKORN-3064] Refactor user_group_limit E2E test suite structure (#972)
    
    Closes: #972
    
    Signed-off-by: Yu-Lin Chen <[email protected]>
---
 .../user_group_limit_suite_test.go                 | 31 ++++++++++++++++
 test/e2e/user_group_limit/user_group_limit_test.go | 43 ++++------------------
 2 files changed, 39 insertions(+), 35 deletions(-)

diff --git a/test/e2e/user_group_limit/user_group_limit_suite_test.go 
b/test/e2e/user_group_limit/user_group_limit_suite_test.go
index 5bdfd3bc..2718009b 100644
--- a/test/e2e/user_group_limit/user_group_limit_suite_test.go
+++ b/test/e2e/user_group_limit/user_group_limit_suite_test.go
@@ -20,6 +20,7 @@ package user_group_limit_test
 
 import (
        "path/filepath"
+       "runtime"
        "testing"
 
        "github.com/onsi/ginkgo/v2"
@@ -27,6 +28,9 @@ import (
        "github.com/onsi/gomega"
 
        "github.com/apache/yunikorn-k8shim/test/e2e/framework/configmanager"
+       "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/common"
+       "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/k8s"
+       "github.com/apache/yunikorn-k8shim/test/e2e/framework/helpers/yunikorn"
 )
 
 func init() {
@@ -46,6 +50,33 @@ func TestUserGroupLimit(t *testing.T) {
        ginkgo.RunSpecs(t, "TestUserGroupLimit", 
ginkgo.Label("TestUserGroupLimit"))
 }
 
+var _ = ginkgo.BeforeSuite(func() {
+       _, filename, _, _ := runtime.Caller(0)
+       suiteName = common.GetSuiteName(filename)
+       // Initializing kubectl client
+       kClient = k8s.KubeCtl{}
+       Ω(kClient.SetClient()).To(gomega.BeNil())
+       // Initializing rest client
+       restClient = yunikorn.RClient{}
+       Ω(restClient).NotTo(gomega.BeNil())
+
+       yunikorn.EnsureYuniKornConfigsPresent()
+
+       ginkgo.By("Port-forward the scheduler pod")
+       var err = kClient.PortForwardYkSchedulerPod()
+       Ω(err).NotTo(gomega.HaveOccurred())
+})
+
+var _ = ginkgo.AfterSuite(func() {
+       ginkgo.By("Check Yunikorn's health")
+       checks, err := yunikorn.GetFailedHealthChecks()
+       Ω(err).NotTo(HaveOccurred())
+       Ω(checks).To(gomega.Equal(""), checks)
+       ginkgo.By("Tearing down namespace: " + dev)
+       err = kClient.TearDownNamespace(dev)
+       Ω(err).NotTo(HaveOccurred())
+})
+
 var Ω = gomega.Ω
 var HaveOccurred = gomega.HaveOccurred
 var dev string
diff --git a/test/e2e/user_group_limit/user_group_limit_test.go 
b/test/e2e/user_group_limit/user_group_limit_test.go
index 2a877aed..4f6b6bc8 100644
--- a/test/e2e/user_group_limit/user_group_limit_test.go
+++ b/test/e2e/user_group_limit/user_group_limit_test.go
@@ -25,7 +25,6 @@ import (
        "net/url"
        "os"
        "path/filepath"
-       "runtime"
        "strings"
        "time"
 
@@ -81,42 +80,16 @@ var (
        }
 )
 
-var _ = ginkgo.BeforeSuite(func() {
-       _, filename, _, _ := runtime.Caller(0)
-       suiteName = common.GetSuiteName(filename)
-       // Initializing kubectl client
-       kClient = k8s.KubeCtl{}
-       Ω(kClient.SetClient()).To(gomega.BeNil())
-       // Initializing rest client
-       restClient = yunikorn.RClient{}
-       Ω(restClient).NotTo(gomega.BeNil())
-
-       yunikorn.EnsureYuniKornConfigsPresent()
-
-       ginkgo.By("Port-forward the scheduler pod")
-       var err = kClient.PortForwardYkSchedulerPod()
-       Ω(err).NotTo(gomega.HaveOccurred())
-})
-
-var _ = ginkgo.BeforeEach(func() {
-       dev = "dev" + common.RandSeq(5)
-       ginkgo.By("create development namespace")
-       ns, err := kClient.CreateNamespace(dev, nil)
-       gomega.Ω(err).NotTo(gomega.HaveOccurred())
-       gomega.Ω(ns.Status.Phase).To(gomega.Equal(v1.NamespaceActive))
-})
+var _ = ginkgo.Describe("UserGroupLimit", func() {
 
-var _ = ginkgo.AfterSuite(func() {
-       ginkgo.By("Check Yunikorn's health")
-       checks, err := yunikorn.GetFailedHealthChecks()
-       Ω(err).NotTo(HaveOccurred())
-       Ω(checks).To(gomega.Equal(""), checks)
-       ginkgo.By("Tearing down namespace: " + dev)
-       err = kClient.TearDownNamespace(dev)
-       Ω(err).NotTo(HaveOccurred())
-})
+       ginkgo.BeforeEach(func() {
+               dev = "dev" + common.RandSeq(5)
+               ginkgo.By("create development namespace")
+               ns, err := kClient.CreateNamespace(dev, nil)
+               gomega.Ω(err).NotTo(gomega.HaveOccurred())
+               gomega.Ω(ns.Status.Phase).To(gomega.Equal(v1.NamespaceActive))
+       })
 
-var _ = ginkgo.Describe("UserGroupLimit", func() {
        ginkgo.It("Verify_maxresources_with_a_specific_user_limit", func() {
                ginkgo.By("Update config")
                // The wait wrapper still can't fully guarantee that the config 
in AdmissionController has been updated.


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

Reply via email to