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

[datadog-monitor] Init fake client store with test objects instead of using create #1538

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

tbavelier
Copy link
Member

@tbavelier tbavelier commented Nov 26, 2024

What does this PR do?

Proposes a way to re-enable the finalizer removal test by initialising the object store with objects in the desired state, mimicking the k8s lifecycle:

  1. Custom resource gets created
  2. Operator adds finalizer
  3. Custom resource is scheduled for deletion (e.g. user ran kubectl delete)
  4. A deletion timestamp is added but the resource is not yet deleted since it has a finalizer
  5. Operator cleans the finalizer
  6. As the object has a deletion timestamp and no finalizer, it gets deleted

Motivation

#1175 upgraded the controller runtime to a version above 0.15.x which prevents objects from being created with a deletion timestamp (or updated/patched), preventing us to test the finalizer removal. So it was disabled in the meantime.

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

Write there any instructions and details you may have to test your PR.

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label

@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.66%. Comparing base (756ed08) to head (3c039e9).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1538   +/-   ##
=======================================
  Coverage   48.66%   48.66%           
=======================================
  Files         226      226           
  Lines       20370    20370           
=======================================
  Hits         9913     9913           
  Misses       9940     9940           
  Partials      517      517           
Flag Coverage Δ
unittests 48.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 756ed08...3c039e9. Read the comment docs.

@tbavelier tbavelier changed the title init fake client store with test objects instead of using create [datadog-monitor] Init fake client store with test objects instead of using create Nov 27, 2024
@tbavelier tbavelier marked this pull request as ready for review November 27, 2024 09:51
@tbavelier tbavelier requested a review from a team as a code owner November 27, 2024 09:51
@tbavelier tbavelier merged commit a647e69 into main Dec 18, 2024
21 checks passed
@tbavelier tbavelier deleted the tbavelier/reenable-finalizer-removal-test branch December 18, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants