Merge pull request #100260 from liggitt/pdb-crud

Replicate update/patch operations from eviction test in conformance CRUD test
This commit is contained in:
Kubernetes Prow Robot 2021-03-16 14:50:40 -07:00 committed by GitHub
commit d4f1102690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 4 deletions

View File

@ -704,9 +704,10 @@
description: PodDisruptionBudget API must support list and deletecollection operations.
release: v1.21
file: test/e2e/apps/disruption.go
- testname: 'PodDisruptionBudget: create and delete object'
- testname: 'PodDisruptionBudget: create, update, patch, and delete object'
codename: '[sig-apps] DisruptionController should create a PodDisruptionBudget [Conformance]'
description: PodDisruptionBudget API must support create and delete operations.
description: PodDisruptionBudget API must support create, update, patch, and delete
operations.
release: v1.21
file: test/e2e/apps/disruption.go
- testname: 'PodDisruptionBudget: Status updates'

View File

@ -98,11 +98,33 @@ var _ = SIGDescribe("DisruptionController", func() {
/*
Release : v1.21
Testname: PodDisruptionBudget: create and delete object
Description: PodDisruptionBudget API must support create and delete operations.
Testname: PodDisruptionBudget: create, update, patch, and delete object
Description: PodDisruptionBudget API must support create, update, patch, and delete operations.
*/
framework.ConformanceIt("should create a PodDisruptionBudget", func() {
ginkgo.By("creating the pdb")
createPDBMinAvailableOrDie(cs, ns, defaultName, intstr.FromString("1%"), defaultLabels)
ginkgo.By("updating the pdb")
updatedPDB := updatePDBOrDie(cs, ns, defaultName, func(pdb *policyv1.PodDisruptionBudget) *policyv1.PodDisruptionBudget {
newMinAvailable := intstr.FromString("2%")
pdb.Spec.MinAvailable = &newMinAvailable
return pdb
}, cs.PolicyV1().PodDisruptionBudgets(ns).Update)
framework.ExpectEqual(updatedPDB.Spec.MinAvailable.String(), "2%")
ginkgo.By("patching the pdb")
patchedPDB := patchPDBOrDie(cs, dc, ns, defaultName, func(old *policyv1.PodDisruptionBudget) (bytes []byte, err error) {
newBytes, err := json.Marshal(map[string]interface{}{
"spec": map[string]interface{}{
"minAvailable": "3%",
},
})
framework.ExpectNoError(err, "failed to marshal JSON for new data")
return newBytes, nil
})
framework.ExpectEqual(patchedPDB.Spec.MinAvailable.String(), "3%")
deletePDBOrDie(cs, ns, defaultName)
})