From 8e0cc7ede2e5988f420c839a43971571405f99d7 Mon Sep 17 00:00:00 2001 From: zhangxiaoyu-zidif Date: Wed, 19 Jul 2017 22:22:01 +0800 Subject: [PATCH] add test case for pdb printer --- pkg/printers/internalversion/printers_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/printers/internalversion/printers_test.go b/pkg/printers/internalversion/printers_test.go index ad47ec7c67e..261eecd4435 100644 --- a/pkg/printers/internalversion/printers_test.go +++ b/pkg/printers/internalversion/printers_test.go @@ -2605,6 +2605,7 @@ func TestPrintService(t *testing.T) { func TestPrintPodDisruptionBudget(t *testing.T) { minAvailable := intstr.FromInt(22) + maxUnavailable := intstr.FromInt(11) tests := []struct { pdb policy.PodDisruptionBudget expect string @@ -2624,6 +2625,22 @@ func TestPrintPodDisruptionBudget(t *testing.T) { }, }, "pdb1\t22\tN/A\t5\t0s\n", + }, + { + policy.PodDisruptionBudget{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns2", + Name: "pdb2", + CreationTimestamp: metav1.Time{Time: time.Now().Add(1.9e9)}, + }, + Spec: policy.PodDisruptionBudgetSpec{ + MaxUnavailable: &maxUnavailable, + }, + Status: policy.PodDisruptionBudgetStatus{ + PodDisruptionsAllowed: 5, + }, + }, + "pdb2\tN/A\t11\t5\t0s\n", }} buf := bytes.NewBuffer([]byte{})