Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR] Fix the never-ending handling cycle #205

Closed
kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Closed

[PR] Fix the never-ending handling cycle #205

kopf-archiver bot opened this issue Aug 18, 2020 · 0 comments
Labels
archive automation CI/CD: testing, linting, releasing automatically bug Something isn't working

Comments

@kopf-archiver
Copy link

kopf-archiver bot commented Aug 18, 2020

A pull request by nolar at 2019-10-11 20:19:15+00:00
Original URL: zalando-incubator/kopf#205
Merged by nolar at 2019-10-22 22:45:16+00:00

Fix the never-ending handling cycle, and fix the tests to catch this.

Issue: #194

Description

These changes below could not be separated into their own PRs, as fixing the tests breaks the operator's CI/CD pipeline (the code is broken in master now), and fixing the issue is not provable (the tests are false-positive in master now). So, they go as one PR with two topics.


Part 1:

While adding the type-annotations in #200, some data structures were split and their handling was reimplemented slightly. In particular, full body and body essence were separated -- to be used in different places and to make it clear that they have different content.

By intention, the essence is a deep copy of the body (there is a line to do that).

However, in the body's essence calculation, labels and annotations were taken from the original body as is, as the dict objects, and the annotations were modified in place to remove the system's/framework's ones -- which broke the intention of the essence being a deep copy of the body.

As a result, the important annotations of the last-seen state were lost also from the body (not only from the essence), and the framework could not detect the cause properly in case of the multi-handler operators (with at least 2 handling cycles), so it always assumed that this is a newly created object (due to absence of the last-seen state), and repeated the handling non-stop, again and again.

The infinite handling during 2 seconds of the e2e tests was never checked and asserted, so it went unnoticed, despite it was logged and captured.

This case is now prevented from happening in the future (beside the fix) by checking how many times every handler-of-interest has succeeded/failed.


Part 2:

While fixing the above-mentioned issue, it was found that the e2e tests were working just by luck: they took the global registry of the previously executed tests, added new handlers, and for this reason could find all the needed log lines in the output -- they were coming from the previous tests, not from the current one.

This issue is now fixed by moving the clear_default_registry fixture to the top-level conftest plugin, and is now auto-applied for all the tests (both unit and e2e).

Once this "test overlapping" effect was removed, few e2e tests actually broke for valid reasons. So, they had to be fixed with proper timing.

Types of Changes

  • Bugfix
@kopf-archiver kopf-archiver bot closed this as completed Aug 18, 2020
@kopf-archiver kopf-archiver bot changed the title [archival placeholder] [PR] Fix the never-ending handling cycle Aug 19, 2020
@kopf-archiver kopf-archiver bot added automation CI/CD: testing, linting, releasing automatically bug Something isn't working labels Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archive automation CI/CD: testing, linting, releasing automatically bug Something isn't working
Projects
None yet
Development

No branches or pull requests

0 participants