Rebase allow updates to pdbs to latest upstream master
This commit is contained in:
@@ -68,30 +68,32 @@ func TestPodDisruptionBudgetStrategy(t *testing.T) {
|
||||
t.Errorf("Unexpected error updating PodDisruptionBudget.")
|
||||
}
|
||||
|
||||
// Changing the selector? No.
|
||||
// Changing the selector? OK
|
||||
newPdb.Spec.Selector = &metav1.LabelSelector{MatchLabels: map[string]string{"a": "bar"}}
|
||||
Strategy.PrepareForUpdate(ctx, newPdb, pdb)
|
||||
errs = Strategy.ValidateUpdate(ctx, newPdb, pdb)
|
||||
if len(errs) == 0 {
|
||||
t.Errorf("Expected a validation error since updates are disallowed on poddisruptionbudgets.")
|
||||
if len(errs) != 0 {
|
||||
t.Errorf("Expected no error on changing selector on poddisruptionbudgets.")
|
||||
}
|
||||
newPdb.Spec.Selector = pdb.Spec.Selector
|
||||
|
||||
// Changing MinAvailable? Also no.
|
||||
// Changing MinAvailable? OK
|
||||
newMinAvailable := intstr.FromString("28%")
|
||||
newPdb.Spec.MinAvailable = &newMinAvailable
|
||||
Strategy.PrepareForUpdate(ctx, newPdb, pdb)
|
||||
errs = Strategy.ValidateUpdate(ctx, newPdb, pdb)
|
||||
if len(errs) == 0 {
|
||||
t.Errorf("Expected a validation error since updates are disallowed on poddisruptionbudgets.")
|
||||
if len(errs) != 0 {
|
||||
t.Errorf("Expected no error updating MinAvailable on poddisruptionbudgets.")
|
||||
}
|
||||
|
||||
// Changing MinAvailable to MaxAvailable? OK
|
||||
maxUnavailable := intstr.FromString("28%")
|
||||
newPdb.Spec.MaxUnavailable = &maxUnavailable
|
||||
newPdb.Spec.MinAvailable = nil
|
||||
Strategy.PrepareForUpdate(ctx, newPdb, pdb)
|
||||
errs = Strategy.ValidateUpdate(ctx, newPdb, pdb)
|
||||
if len(errs) == 0 {
|
||||
t.Errorf("Expected a validation error since updates are disallowed on poddisruptionbudgets.")
|
||||
if len(errs) != 0 {
|
||||
t.Errorf("Expected no error updating replacing MinAvailable with MaxUnavailable on poddisruptionbudgets.")
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user