Commit 592de1d0 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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 ```
parents 6aeb7905 8e0cc7ed
...@@ -2630,6 +2630,7 @@ func TestPrintService(t *testing.T) { ...@@ -2630,6 +2630,7 @@ func TestPrintService(t *testing.T) {
func TestPrintPodDisruptionBudget(t *testing.T) { func TestPrintPodDisruptionBudget(t *testing.T) {
minAvailable := intstr.FromInt(22) minAvailable := intstr.FromInt(22)
maxUnavailable := intstr.FromInt(11)
tests := []struct { tests := []struct {
pdb policy.PodDisruptionBudget pdb policy.PodDisruptionBudget
expect string expect string
...@@ -2649,6 +2650,22 @@ func TestPrintPodDisruptionBudget(t *testing.T) { ...@@ -2649,6 +2650,22 @@ func TestPrintPodDisruptionBudget(t *testing.T) {
}, },
}, },
"pdb1\t22\tN/A\t5\t0s\n", "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{}) buf := bytes.NewBuffer([]byte{})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment