⚠️ Fakeclient: Reject Delete with mismatched ResourceVersion#1582
⚠️ Fakeclient: Reject Delete with mismatched ResourceVersion#1582k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom 2uasimojo:fake-delete-ResourceVersion
Conversation
|
Welcome @2uasimojo! |
|
Hi @2uasimojo. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
`Delete` takes optional varargs comprising `DeleteOption`s. Previously fakeclient was validating that these could be run through `ApplyOptions`, but otherwise ignoring them. With this commit, fakeclient will observe a `DeleteOption` specifying a `Precondition.ResourceVersion`, rejecting the deletion if the value does not match what's on the "server", bringing fakeclient's behavior more in line with a real client. Note that, while technically a breaking change, any test that was relying on the previous behavior was already broken. xref #832 / 25ef372 which did something similar for `Create` and `Update`. Major difference being that those methods do `ResourceVersion` matching by default, whereas `Delete` only does it if opted in via the `Precondition`.
|
/test pull-controller-runtime-test-master |
1 similar comment
|
/test pull-controller-runtime-test-master |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 2uasimojo, alvaroaleman The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The resource version is now required: kubernetes-sigs/controller-runtime#1582 ("Fakeclient: Reject Delete with mismatched ResourceVersion").
And fix broken unit tests: - elasticsearch/driver.TestUpgradePodsDeletion_WithNodeTypeMutations - elasticsearch/driver.TestUpgradePodsDeletion_Delete - enterprisesearch.TestReconcileEnterpriseSearch_doReconcile_AssociationDelaysVersionUpgrade - license/trial.TestReconcileTrials_Reconcile/valid_trial_secret_inits_trial With: - Set resource version in newTestPod - Do not reuse the same variable to get trial/license secrets - Always SetAssociationConf before doReconcile Because of: - Client: Ensure no stale data remains in target object kubernetes-sigs/controller-runtime#1640 - Fakeclient: Reject Delete with mismatched ResourceVersion kubernetes-sigs/controller-runtime#1582
And fix broken unit tests: - elasticsearch/driver.TestUpgradePodsDeletion_WithNodeTypeMutations - elasticsearch/driver.TestUpgradePodsDeletion_Delete - enterprisesearch.TestReconcileEnterpriseSearch_doReconcile_AssociationDelaysVersionUpgrade - license/trial.TestReconcileTrials_Reconcile/valid_trial_secret_inits_trial With: - Set resource version in newTestPod - Do not reuse the same variable to get trial/license secrets - Always SetAssociationConf before doReconcile Because of: - Client: Ensure no stale data remains in target object kubernetes-sigs/controller-runtime#1640 - Fakeclient: Reject Delete with mismatched ResourceVersion kubernetes-sigs/controller-runtime#1582
Deletetakes optional varargs comprisingDeleteOptions. Previously fakeclient was validating that these could be run throughApplyOptions, but otherwise ignoring them.With this commit, fakeclient will observe a
DeleteOptionspecifying aPrecondition.ResourceVersion, rejecting the deletion if the value does not match what's on the "server", bringing fakeclient's behavior more in line with a real client.Note that, while technically a breaking change, any test that was relying on the previous behavior was already broken.
xref #832 / 25ef372 which did something similar for
CreateandUpdate. Major difference being that those methods doResourceVersionmatching by default, whereasDeleteonly does it if opted in via thePrecondition./assign @vincepri
/assign @mengqiy
/cc @alvaroaleman
/cc @djzager