Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxuzhonghu committed Jul 15, 2019
1 parent 138044e commit 7f7eb55
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/controllers/job/job_controller_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/rest"
"testing"
"volcano.sh/volcano/pkg/apis/helpers"

"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -66,13 +67,21 @@ func newController() *Controller {
}

func buildPod(namespace, name string, p v1.PodPhase, labels map[string]string) *v1.Pod {
boolValue := true
return &v1.Pod{
ObjectMeta: metav1.ObjectMeta{
UID: types.UID(fmt.Sprintf("%v-%v", namespace, name)),
Name: name,
Namespace: namespace,
Labels: labels,
ResourceVersion: string(uuid.NewUUID()),
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: helpers.JobKind.GroupVersion().String(),
Kind: helpers.JobKind.Kind,
Controller: &boolValue,
},
},
},
Status: v1.PodStatus{
Phase: p,
Expand Down

0 comments on commit 7f7eb55

Please sign in to comment.