mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-18 08:09:58 +00:00
add test case for pdb printer
This commit is contained in:
parent
2e6e314ade
commit
8e0cc7ede2
@ -2605,6 +2605,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
|
||||||
@ -2624,6 +2625,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