Merge pull request #49206 from zhangxiaoyu-zidif/add-unittest-print-for-pdb

Automatic merge from submit-queue (batch tested with PRs 50418, 49830, 49206, 49061, 49912)

Add UT case for pdb printer

**What this PR does / why we need it**:
Add UT case for pdb printer

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
NONE
**Special notes for your reviewer**:
NONE
**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-08-09 22:07:18 -07:00 committed by GitHub
commit 592de1d0af

View File

@ -2630,6 +2630,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
@ -2649,6 +2650,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{})