zalando-incubator / kopf Public archive
Don’t add finalizers to skipped objects #173
Don’t add finalizers to skipped objects #173
Conversation
Signed-off-by: Daniel Middlecote <dlmiddlecote@gmail.com>
|
Tests seem to be failing on 1 flakey test. |
Hi @dlmiddlecote, Thank you so much for the PR! @nolar |
Codecov Report
@@ Coverage Diff @@
## master #173 +/- ##
=========================================
+ Coverage 81.33% 81.4% +0.07%
=========================================
Files 32 33 +1
Lines 1639 1678 +39
Branches 237 243 +6
=========================================
+ Hits 1333 1366 +33
- Misses 260 263 +3
- Partials 46 49 +3
|
Hey @psycho-ir Is this the case?
If so, I just tried this, and it seems to work. Let me know if I'm mistaken. |
def fn(**_): | ||
pass | ||
|
||
assert registry.requires_finalizer(resource=resource, body=OBJECT_BODY) is not optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This construct is a bit counter-intuitive. Maybe, parametrize with 2 values: @pytest.mark.parametrize('optional, expected'...
, and then compare with == expected
.
Also, it is better to put the actual result of a function call to a variable, and then use it in the assertion. Pytest then renders the failed assertions nice (and not so nice in some case when the function call is used: because double-calling for rendering can have side-effects).
Signed-off-by: Daniel Middlecote <dlmiddlecote@gmail.com>
Hi @dlmiddlecote, Sorry you are right this scenario works perfectly fine.
|
Hey! I also can't reproduce. I have the operator as:
Then I apply:
and the finalizer is applied. I then run: and the finalizer is removed. |
Right I probably did a mistake in my tests, all the scenarios are working a charm. |
PS: The solution in general is fine. I suggest that we merge it now, and release as 0.21rcX (x=3..4 or so), together with lots of other bugfixes/refactorings/improvements, and test them altogether. |
Totally agree |
Pre-released as kopf==0.21rc3 — but beware of other massive changes in rc1+rc2+rc3 combined (see Releases). |
Description
Don't add finalizer to object if there are no handlers for it. Now that it is possible to filter objects out of handler execution, this is pertinent.
Types of Changes
Tasks
Review