Fix kubectl describe job event test nil pointer
Kubernetes-commit: a576a3c7070c9aeb1da1878e0ca956190979f03a
This commit is contained in:
parent
35098e8b21
commit
9e97ec383e
|
@ -2116,7 +2116,9 @@ func describeJob(job *batchv1.Job, events *corev1.EventList) (string, error) {
|
|||
if controlledBy := printController(job); len(controlledBy) > 0 {
|
||||
w.Write(LEVEL_0, "Controlled By:\t%s\n", controlledBy)
|
||||
}
|
||||
w.Write(LEVEL_0, "Parallelism:\t%d\n", *job.Spec.Parallelism)
|
||||
if job.Spec.Parallelism != nil {
|
||||
w.Write(LEVEL_0, "Parallelism:\t%d\n", *job.Spec.Parallelism)
|
||||
}
|
||||
if job.Spec.Completions != nil {
|
||||
w.Write(LEVEL_0, "Completions:\t%d\n", *job.Spec.Completions)
|
||||
} else {
|
||||
|
|
|
@ -28,6 +28,7 @@ import (
|
|||
appsv1 "k8s.io/api/apps/v1"
|
||||
autoscalingv1 "k8s.io/api/autoscaling/v1"
|
||||
autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2"
|
||||
batchv1 "k8s.io/api/batch/v1"
|
||||
coordinationv1 "k8s.io/api/coordination/v1"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
|
||||
|
@ -2730,8 +2731,14 @@ func TestDescribeEvents(t *testing.T) {
|
|||
},
|
||||
}, events),
|
||||
},
|
||||
// TODO(jchaloup): add tests for:
|
||||
// - JobDescriber
|
||||
"JobDescriber": &JobDescriber{
|
||||
fake.NewSimpleClientset(&batchv1.Job{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "bar",
|
||||
Namespace: "foo",
|
||||
},
|
||||
}, events),
|
||||
},
|
||||
"IngressDescriber": &IngressDescriber{
|
||||
fake.NewSimpleClientset(&networkingv1beta1.Ingress{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
|
Loading…
Reference in New Issue