Skip to content

Commit

Permalink
refactor: remove siCommon
Browse files Browse the repository at this point in the history
  • Loading branch information
Cliff Su committed Oct 21, 2023
1 parent 80f0c7d commit bfa4de5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pkg/cache/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"github.com/apache/yunikorn-k8shim/pkg/common/utils"
"github.com/apache/yunikorn-k8shim/pkg/dispatcher"
"github.com/apache/yunikorn-k8shim/pkg/log"
siCommon "github.com/apache/yunikorn-scheduler-interface/lib/go/common"
"github.com/apache/yunikorn-scheduler-interface/lib/go/si"
)

Expand Down Expand Up @@ -436,7 +435,7 @@ func (task *Task) postTaskBound() {
if pod.Annotations == nil {
pod.Annotations = make(map[string]string)
}
pod.Annotations[siCommon.DomainYuniKorn+"scheduled-at"] = strconv.FormatInt(time.Now().UnixNano(), 10)
pod.Annotations[constants.DomainYuniKorn+"scheduled-at"] = strconv.FormatInt(time.Now().UnixNano(), 10)

Check warning on line 438 in pkg/cache/task.go

View check run for this annotation

Codecov / codecov/patch

pkg/cache/task.go#L438

Added line #L438 was not covered by tests
}); err != nil {
log.Log(log.ShimCacheTask).Warn("failed to update pod status", zap.Error(err))
}
Expand Down
10 changes: 4 additions & 6 deletions test/e2e/admission_controller/admission_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ import (
"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"

siCommon "github.com/apache/yunikorn-scheduler-interface/lib/go/common"
)

const userInfoAnnotation = siCommon.DomainYuniKorn + "user.info"
const userInfoAnnotation = constants.DomainYuniKorn + "user.info"
const nonExistentNode = "non-existent-node"
const defaultPodTimeout = 10 * time.Second
const cronJobPodTimeout = 65 * time.Second
Expand Down Expand Up @@ -224,11 +222,11 @@ var _ = ginkgo.Describe("AdmissionController", func() {
gomega.Ω(err).ShouldNot(gomega.HaveOccurred())
pod, err = kubeClient.GetPod(pod.Name, ns)
gomega.Ω(err).ShouldNot(gomega.HaveOccurred())
userinfo := pod.Annotations[siCommon.DomainYuniKorn+"user.info"]
userinfo := pod.Annotations[constants.DomainYuniKorn+"user.info"]
gomega.Ω(userinfo).Should(gomega.Not(gomega.BeNil()))

ginkgo.By("Attempt to update userinfo annotation")
_, err = kubeClient.UpdatePodWithAnnotation(pod, ns, siCommon.DomainYuniKorn+"user.info", "shouldnotsucceed")
_, err = kubeClient.UpdatePodWithAnnotation(pod, ns, constants.DomainYuniKorn+"user.info", "shouldnotsucceed")
gomega.Ω(err).Should(gomega.HaveOccurred())
})

Expand Down Expand Up @@ -516,7 +514,7 @@ func runWorkloadTest(workloadType k8s.WorkloadType, create func() (string, error
fmt.Fprintf(ginkgo.GinkgoWriter, "Running pod is %s\n", pods.Items[0].Name)
pod, err2 := kubeClient.GetPod(pods.Items[0].Name, ns)
gomega.Ω(err2).ShouldNot(gomega.HaveOccurred())
userinfo := pod.Annotations[siCommon.DomainYuniKorn+"user.info"]
userinfo := pod.Annotations[constants.DomainYuniKorn+"user.info"]
gomega.Ω(userinfo).Should(gomega.Not(gomega.BeNil()))
}

Expand Down

0 comments on commit bfa4de5

Please sign in to comment.