Skip to content

Commit

Permalink
[YUNIKORN-2474] Delete unused variable and methods (#800)
Browse files Browse the repository at this point in the history
Closes: #800

Signed-off-by: Peter Bacsko <[email protected]>
  • Loading branch information
amikai authored and pbacsko committed Apr 3, 2024
1 parent 57ab4d5 commit cfaa06e
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions test/e2e/wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ package e2e

import (
"fmt"
"time"

"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"gopkg.in/yaml.v3"
v1 "k8s.io/api/core/v1"

"github.com/apache/yunikorn-core/pkg/common/configs"
"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"
Expand All @@ -36,61 +32,6 @@ import (

var k = k8s.KubeCtl{}

func UpdateConfigMapWrapper(oldConfigMap *v1.ConfigMap, schedPolicy string, annotation string) {
By("Enabling new scheduling config")

// Save old configMap
Ω(k.SetClient()).To(BeNil())
var c, err = k.GetConfigMaps(configmanager.YuniKornTestConfig.YkNamespace,
configmanager.GetConfigMapName())
Ω(err).NotTo(HaveOccurred())
Ω(c).NotTo(BeNil())
c.DeepCopyInto(oldConfigMap)
Ω(c).Should(BeEquivalentTo(oldConfigMap))

// Create fair configMap with timestamp
sc := common.CreateBasicConfigMap()
if schedPolicy != "" {
err = common.SetSchedulingPolicy(sc, "default", "root", schedPolicy)
Ω(err).NotTo(HaveOccurred())
}
ts, tsErr := common.SetQueueTimestamp(sc, "default", "root")
Ω(tsErr).NotTo(HaveOccurred())
configStr, yamlErr := common.ToYAML(sc)
Ω(yamlErr).NotTo(HaveOccurred())
c.Data[configmanager.DefaultPolicyGroup] = configStr
var d, err3 = k.UpdateConfigMap(c, configmanager.YuniKornTestConfig.YkNamespace)
Ω(err3).NotTo(HaveOccurred())
Ω(d).NotTo(BeNil())

err = yunikorn.WaitForQueueTS("root", ts, 2*time.Minute)
Ω(err).NotTo(HaveOccurred())
}

func RestoreConfigMapWrapper(oldConfigMap *v1.ConfigMap, annotation string) {
Ω(k.SetClient()).To(BeNil())
By("Restoring the old config maps")
var c, err = k.GetConfigMaps(configmanager.YuniKornTestConfig.YkNamespace,
configmanager.GetConfigMapName())
Ω(err).NotTo(HaveOccurred())
Ω(c).NotTo(BeNil())

oldSC := new(configs.SchedulerConfig)
err = yaml.Unmarshal([]byte(oldConfigMap.Data[configmanager.DefaultPolicyGroup]), oldSC)
Ω(err).NotTo(HaveOccurred())
ts, tsErr := common.SetQueueTimestamp(oldSC, "default", "root")
Ω(tsErr).NotTo(HaveOccurred())
c.Data[configmanager.DefaultPolicyGroup], err = common.ToYAML(oldSC)
Ω(err).NotTo(HaveOccurred())

var e, err3 = k.UpdateConfigMap(c, configmanager.YuniKornTestConfig.YkNamespace)
Ω(err3).NotTo(HaveOccurred())
Ω(e).NotTo(BeNil())

err = yunikorn.WaitForQueueTS("root", ts, 2*time.Minute)
Ω(err).NotTo(HaveOccurred())
}

func DumpClusterInfoIfSpecFailed(suiteName string, namespaces []string) {
// should call this function in ginkgo.AfterEach
// write cluster info to files by log type (ykFullStateDump, k8sClusterInfo, ykContainerLog)
Expand Down

0 comments on commit cfaa06e

Please sign in to comment.