Skip to content

Commit

Permalink
Fix test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
workingloong committed Feb 3, 2025
1 parent 2290ada commit deaeb3c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/master/pkg/kubeutils/elasticjob_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

var _ = Describe("Elasticjob", func() {
It("Get an elasticjob instance", func() {
kubeConfigPath := os.Getenv("KUBENETES_CLUSTER_CONFIG")
kubeConfigPath := os.Getenv("KUBERNETES_CONFIG_PATH")
if kubeConfigPath != "" {
NewGlobalK8sClient(kubeConfigPath, "dlrover")
job := GetElasticJobInstance("torch-mnist")
Expand Down
16 changes: 15 additions & 1 deletion go/master/pkg/kubeutils/pod_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ import (
"fmt"
"os"

elasticjobv1 "github.com/intelligent-machine-learning/dlrover/go/elasticjob/api/v1alpha1"
commonv1 "github.com/intelligent-machine-learning/dlrover/go/elasticjob/pkg/common/api/v1"
"github.com/intelligent-machine-learning/dlrover/go/master/pkg/common"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
kubeerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ = Describe("Pod", func() {
Expand Down Expand Up @@ -54,7 +57,18 @@ var _ = Describe("Pod", func() {
},
},
}
pod := BuildPod(jobContext, podConfig)
job := &elasticjobv1.ElasticJob{
ObjectMeta: metav1.ObjectMeta{
Name: "test-training",
Namespace: "easydl",
Annotations: map[string]string{},
Labels: map[string]string{},
},
Spec: elasticjobv1.ElasticJobSpec{
ReplicaSpecs: map[commonv1.ReplicaType]*elasticjobv1.ReplicaSpec{},
},
}
pod := BuildPod(jobContext, podConfig, job)
Expect(pod.ObjectMeta.Name).To(Equal("train-demo-worker-0"))
Expect(pod.ObjectMeta.Namespace).To(Equal("dlrover"))
jobName, ok := pod.ObjectMeta.Labels[labelJobKey]
Expand Down

0 comments on commit deaeb3c

Please sign in to comment.