Rebase allow updates to pdbs to latest upstream master

This commit is contained in:
David McCormick
2018-10-16 11:15:34 +01:00
parent 74469297fe
commit 5b9e4f1e88
5 changed files with 105 additions and 46 deletions

View File

@@ -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.")
}
}