mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Merge pull request #89945 from k-toyoda-pi/add_error_check_e2e_disruption
Add error check for marshaling json in e2e/apps/disruption
This commit is contained in:
commit
1c01efe10f
@ -132,9 +132,11 @@ var _ = SIGDescribe("DisruptionController", func() {
|
||||
|
||||
ginkgo.By("Patching PodDisruptionBudget status")
|
||||
patched, _ := patchPDBOrDie(cs, dc, ns, defaultName, func(old *policyv1beta1.PodDisruptionBudget) (bytes []byte, err error) {
|
||||
oldBytes, _ := json.Marshal(old)
|
||||
oldBytes, err := json.Marshal(old)
|
||||
framework.ExpectNoError(err, "failed to marshal JSON for old data")
|
||||
old.Status.DisruptedPods = make(map[string]metav1.Time)
|
||||
newBytes, _ := json.Marshal(old)
|
||||
newBytes, err := json.Marshal(old)
|
||||
framework.ExpectNoError(err, "failed to marshal JSON for new data")
|
||||
return jsonpatch.CreateMergePatch(oldBytes, newBytes)
|
||||
}, "status")
|
||||
framework.ExpectEmpty(patched.Status.DisruptedPods, "Expecting the PodDisruptionBudget's be empty")
|
||||
@ -303,10 +305,12 @@ var _ = SIGDescribe("DisruptionController", func() {
|
||||
ginkgo.By("Patching the pdb to disallow a pod to be evicted")
|
||||
patchPDBOrDie(cs, dc, ns, defaultName, func(old *policyv1beta1.PodDisruptionBudget) (bytes []byte, err error) {
|
||||
oldData, err := json.Marshal(old)
|
||||
framework.ExpectNoError(err, "failed to marshal JSON for old data")
|
||||
old.Spec.MinAvailable = nil
|
||||
maxUnavailable := intstr.FromInt(0)
|
||||
old.Spec.MaxUnavailable = &maxUnavailable
|
||||
newData, _ := json.Marshal(old)
|
||||
newData, err := json.Marshal(old)
|
||||
framework.ExpectNoError(err, "failed to marshal JSON for new data")
|
||||
return jsonpatch.CreateMergePatch(oldData, newData)
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user