-
Notifications
You must be signed in to change notification settings - Fork 87
Test the event handling; and separate the cause detection from handling #82
Conversation
🤖 zincr found 0 problems , 1 warning
Details on how to resolve are provided below Large CommitsChecks all commits for large additions to a single file. Large commits should be reviewed more carefully for potential copyright and licensing issues This file contains a substantial change, please review to determine if the change comes from an external source and if there are any copyright or licensing issues to be aware of
|
🤖 zincr found 1 problem , 1 warning
Details on how to resolve are provided below ApprovalsAll proposed changes must be reviewed by project maintainers before they can be merged Not enough people have approved this pull request - please ensure that 1 additional user, who have not contributed to this pull request approve the changes.
Large CommitsChecks all commits for large additions to a single file. Large commits should be reviewed more carefully for potential copyright and licensing issues This file contains a substantial change, please review to determine if the change comes from an external source and if there are any copyright or licensing issues to be aware of
|
kopf/reactor/causation.py
Outdated
body = event['object'] | ||
|
||
# The object was really deleted from the cluster. But we do not care anymore. | ||
if etyp == 'DELETED': |
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.
maybe "event_type" instead of "etyp"? I don't like abbreviations/acronyms :-/
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.
Fixed by removing the variable completely. It is used only in one place now (previously (long time ago) there were 2-3 places).
tests/handling/conftest.py
Outdated
* Registered handlers in a global registry. Each handler is a normal function, | ||
which calls a mock -- to ease the assertions. | ||
|
||
As the output, we check the mocked calls on the following: |
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.
Output:
Check mocked calls of: ...
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.
Not sure here about "check mock calls". Fixed to "check mockED calls". Why is it "mock calls"?
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.
I edited :)
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.
Actually I'd have made it less verbose, for instance
`Output
Check mocked calls of:
- bla
- bla `
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.
mkay, markdown is not helping
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.
Otherwise yes it's ok to have the "the" in there :)
Briefly: add tests for the core part of Kopf: event handling.
This covers the whole chain of handling: from the raw streaming/watching event reception and down to the handler function invocation.
Two sections are explicitly separated from the previous handling routine — to make them testable:
kopf.reactor.causation
) — for converting all possible event type and object fields combinations to the cause objects.kopf.reactor.handling
) — for actual handler invocation, logging, exception handling, status/progress storage, patching, sleeping, etc.As part of this PR, a refactoring is made to split these two parts into separate modules, so that become testable.