Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Enable testing SubReconcilers with duck typed resources #454

Merged
merged 1 commit into from
Nov 6, 2023
Merged

Enable testing SubReconcilers with duck typed resources #454

merged 1 commit into from
Nov 6, 2023

Conversation

scothis
Copy link
Contributor

@scothis scothis commented Nov 6, 2023

The Resource is now converted to an unstructured before being set as a given on the fake client. Previously it would panic because the duck was not registered on the scheme (which it should not be).

The Resource is now converted to an unstructured before being set as a
given on the fake client. Previously it would panic because the duck was
not registered on the scheme (which it should not be).

Signed-off-by: Scott Andrews <andrewssc@vmware.com>
Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (e19c127) 60.68% compared to head (b586df9) 60.54%.

❗ Current head b586df9 differs from pull request most recent head ddfd714. Consider uploading reports for the commit ddfd714 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #454      +/-   ##
==========================================
- Coverage   60.68%   60.54%   -0.15%     
==========================================
  Files          26       26              
  Lines        2526     2532       +6     
==========================================
  Hits         1533     1533              
- Misses        904      910       +6     
  Partials       89       89              
Files Coverage Δ
testing/subreconciler.go 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

testName := "test-resource"

scheme := runtime.NewScheme()
// _ = resources.AddToScheme(scheme)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is this to convey that a duck need not be registered?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, it's fine for these types to be registered, but having them not registered proves they are not needed.

Copy link
Collaborator

@squeedee squeedee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working perfectly for my use-case . Thankyou!

@scothis scothis merged commit d4d2708 into vmware-labs:main Nov 6, 2023
2 of 4 checks passed
@scothis scothis deleted the sub-duck branch November 6, 2023 16:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants