fix kubectl describe pod, show tolerationSeconds

This commit is contained in:
Kevin 2017-02-27 21:28:45 +08:00
parent bf984aa328
commit 49072c810a
2 changed files with 5 additions and 2 deletions

View File

@ -2893,6 +2893,9 @@ func printTolerationsMultilineWithIndent(w *PrefixWriter, initialIndent, title,
if len(toleration.Effect) != 0 { if len(toleration.Effect) != 0 {
w.Write(LEVEL_0, ":%s", toleration.Effect) w.Write(LEVEL_0, ":%s", toleration.Effect)
} }
if toleration.TolerationSeconds != nil {
w.Write(LEVEL_0, " for %ds", *toleration.TolerationSeconds)
}
w.Write(LEVEL_0, "\n") w.Write(LEVEL_0, "\n")
i++ i++
} }

View File

@ -78,7 +78,7 @@ func TestDescribePodTolerations(t *testing.T) {
Spec: api.PodSpec{ Spec: api.PodSpec{
Tolerations: []api.Toleration{ Tolerations: []api.Toleration{
{Key: "key1", Value: "value1"}, {Key: "key1", Value: "value1"},
{Key: "key2", Value: "value2"}, {Key: "key2", Value: "value2", Effect: api.TaintEffectNoExecute, TolerationSeconds: &[]int64{300}[0]},
}, },
}, },
}) })
@ -88,7 +88,7 @@ func TestDescribePodTolerations(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }
if !strings.Contains(out, "key1=value1") || !strings.Contains(out, "key2=value2") || !strings.Contains(out, "Tolerations:") { if !strings.Contains(out, "key1=value1") || !strings.Contains(out, "key2=value2:NoExecute for 300s") || !strings.Contains(out, "Tolerations:") {
t.Errorf("unexpected out: %s", out) t.Errorf("unexpected out: %s", out)
} }
} }