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

Validate nested reconcilers at test-time #583

Closed
mamachanko opened this issue Jan 30, 2025 · 1 comment · Fixed by #588
Closed

Validate nested reconcilers at test-time #583

mamachanko opened this issue Jan 30, 2025 · 1 comment · Fixed by #588
Assignees

Comments

@mamachanko
Copy link
Contributor

This is a follow-up for #578.

Given I have a nested reconciler (say Advice[Sequence[ChildReconciler, ChildReconciler]])
When I run tests for the outer reconciler (say Advice)
Then I would like my tests to error (not panic) and to see error messages for any of the reconcilers in the tree (say ChildReconciler)

@mamachanko
Copy link
Contributor Author

mamachanko commented Feb 3, 2025

@scothis would you be so kind and assign this to me? I can't self-assign.

mamachanko added a commit to mamachanko/reconcilerio-runtime that referenced this issue Feb 7, 2025
* Nested validation is configured via the context with
  reconcilers#WithNestedValidation

* (Sub)Reconciler tests always do nested validation

* Moves the Validator interface from testing into reconcilers

* Sequence now implements the Validator interface. Its Validate is not
  called from its SetupWithManager to avoid duplicate validations.

fixes reconcilerio#583

Signed-off-by: Max Brauer <[email protected]>
mamachanko added a commit to mamachanko/reconcilerio-runtime that referenced this issue Feb 7, 2025
* Nested validation is configured via the context with
  reconcilers#WithNestedValidation

* (Sub)Reconciler tests always do nested validation

* Moves the Validator interface from testing into reconcilers

* Sequence now implements the Validator interface. Its Validate is not
  called from its SetupWithManager to avoid duplicate validations.

fixes reconcilerio#583

Signed-off-by: Max Brauer <[email protected]>
mamachanko added a commit to mamachanko/reconcilerio-runtime that referenced this issue Feb 10, 2025
* Nested validation is configured via the context with
  reconcilers#WithNestedValidation

* (Sub)Reconciler tests always do nested validation

* Moves the Validator interface from testing into reconcilers

* Sequence now implements the Validator interface. Its Validate is not
  called from its SetupWithManager to avoid duplicate validations.

fixes reconcilerio#583

Signed-off-by: Max Brauer <[email protected]>
scothis pushed a commit that referenced this issue Feb 10, 2025
* Validate nested reconcilers

* Nested validation is configured via the context with
  reconcilers#WithNestedValidation

* (Sub)Reconciler tests always do nested validation

* Moves the Validator interface from testing into reconcilers

* Sequence now implements the Validator interface. Its Validate is not
  called from its SetupWithManager to avoid duplicate validations.

fixes #583

Signed-off-by: Max Brauer <[email protected]>

* Move validation into its own package and improve function names

Signed-off-by: Max Brauer <[email protected]>

* Format validation errors with the error verb to preserve types

Signed-off-by: Max Brauer <[email protected]>

* Initialize reconcilers when validating for better error messages

* A few reconcilers have not had an init method yet. Now, they do.

* Aggregate and Advice are defaulting fields on init. That means
  some their invalid cases are no longer possible.

Signed-off-by: Max Brauer <[email protected]>

* Validate IfThen#Else

Signed-off-by: Max Brauer <[email protected]>

---------

Signed-off-by: Max Brauer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant