Kong / go-database-reconciler

Apache License 2.0
5 stars 3 forks source link

fix(diff): support auto fields #136

Closed samugi closed 1 month ago

samugi commented 1 month ago

Summary

fix(diff): support auto fields

call the new utils function FillPluginsDefaultsAutoFields from  go-kong
to ensure auto fields are considered when doing the diff

fix(crud): detect operation correctly

fixes a bug that was introduced in
e72f4c2de6609998d5e5671e14a9f7c0cd6a4c3e where noops were still detected
as updates. That happened because of a check happening in plugin.go that
detected the crud operation based on a diff.
When done without considering default/auto fields, this check would see
differences where there were none. This resulted in unnecessary updates
to the DB and wrong diff strings during `sync` and `diff`.

This commit adds defaults/auto fields to the configuration used for that
diff.

Full changelog

Issues resolved

KAG-5210

Documentation

Testing

samugi commented 1 month ago

TestRBACRolesCollection_Get/gets_a_rbacRole_by_ID failing for some reason as a consequence to the bump of go version, looking into it (seems unrelated to the changes here).

randmonkey commented 1 month ago

TestRBACRolesCollection_Get/gets_a_rbacRole_by_ID failing for some reason as a consequence to the bump of go version, looking into it (seems unrelated to the changes here).

I am not sure why it fails just for this PR. But removing the //nolint:gosec in pkg/state/rbac_role_test.go could fix.

samugi commented 1 month ago

TestRBACRolesCollection_Get/gets_a_rbacRole_by_ID failing for some reason as a consequence to the bump of go version, looking into it (seems unrelated to the changes here).

I am not sure why it fails just for this PR. But removing the //nolint:gosec in pkg/state/rbac_role_test.go could fix.

I tried that, then the test itself fails, apparently the RBACRole creation fails. digging

samugi commented 1 month ago

I isolated the bump of go-kong here: https://github.com/Kong/go-database-reconciler/pull/137, it required a small change to make RBAC tests pass, which I cannot explain. @randmonkey

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.

Project coverage is 29.97%. Comparing base (25ccc04) to head (72266da).

Files with missing lines Patch % Lines
pkg/types/plugin.go 0.00% 8 Missing :warning:
pkg/diff/diff.go 0.00% 7 Missing :warning:
pkg/types/core.go 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #136 +/- ## ========================================== - Coverage 29.99% 29.97% -0.03% ========================================== Files 106 106 Lines 12571 12581 +10 ========================================== Hits 3771 3771 - Misses 8340 8350 +10 Partials 460 460 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.