[CONTP-1604] When user updates k8s genericresource, force re-create if deleted#2909
[CONTP-1604] When user updates k8s genericresource, force re-create if deleted#2909
Conversation
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
MockHandler and its state (mockGetErr, mockUpdateErr, etc.) lived in utils.go but were only referenced from test files, causing golangci-lint to flag them as unused (and the error vars as violating errname). Moved all mock code to mock_handler_test.go and registered the handler via init(), with a testHandlers map in utils.go as the bridge.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2909 +/- ##
==========================================
+ Coverage 39.99% 40.00% +0.01%
==========================================
Files 320 320
Lines 28122 28107 -15
==========================================
- Hits 11247 11245 -2
+ Misses 16052 16042 -10
+ Partials 823 820 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
|
🎯 Code Coverage (details) 🔗 Commit SHA: b83f014 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
aedb981 to
070fc64
Compare
…eneric-resource-improvements
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5452f09df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // +kubebuilder:validation:Enum=dashboard;downtime;monitor;notebook;synthetics_api_test;synthetics_browser_test | ||
| Type SupportedResourcesType `json:"type"` | ||
| // JsonSpec is the specification of the API object | ||
| // +kubebuilder:validation:MinLength=1 |
There was a problem hiding this comment.
This is what the validation.go used to do but it's better to enforce it at CRD level since we don't do any complex validation
What does this PR do?
During the update loop of a genericresource, sends a create instead of update if not found: 19d3182
Move test / mocking implementation to a
_testfiles to avoid linter failures and decouple production code from test (not 100% due to the wiring still ingetHandler) 1c5f8e6Remove validation.go since it's enforced at CRD admission anyway: b83f014
Motivation
Avoid having to wait for defaultForceSync in the following scenario:
This PR removes step 4
Additional Notes
Anything else we should know when reviewing?
Minimum Agent Versions
Are there minimum versions of the Datadog Agent and/or Cluster Agent required?
Describe your test plan
Follow the steps from motivation, and ensure resource is created after the DDGR manifest update
Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel