mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
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:
commit
592de1d0af
@ -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) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"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{})
|
||||||
|
Loading…
Reference in New Issue
Block a user