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

Create custom matchers for internal/testtypes #5157

Closed
killianmuldoon opened this issue Aug 26, 2021 · 4 comments · Fixed by #5259
Closed

Create custom matchers for internal/testtypes #5157

killianmuldoon opened this issue Aug 26, 2021 · 4 comments · Fixed by #5259
Assignees
Labels
area/clusterclass Issues or PRs related to clusterclass area/testing Issues or PRs related to testing kind/feature Categorizes issue or PR as related to a new feature.
Milestone

Comments

@killianmuldoon
Copy link
Contributor

killianmuldoon commented Aug 26, 2021

Detailed Description
Composable custom matchers should be created in order to test whether the outcome of reconciliation or other action is as intended while ignoring fields in the resulting objects that aren't of interest.

Examples

  • The Kubernetes testing FakeClient currently adds a resourceVersion to objects on creation. This can cause raw comparison checks to fail. Other Metadata fields handled by the API server - creation time, generation etc. are similarly not of interest most of the time when comparing objects.
  • Integration tests involve the creation of large nested objects with references to other objects. Some of these objects, e.g. templates, may undergo mutation during reconciliation which isn't of interest to the comparison for the test. In the case of templates they may be rotated and so have a new, unpredictable generated name. Matching should be possible based on characteristics specified in either an allowlist or a blocklist.

The target use case for these matchers is in testing, and initially for the controllers/topology package. These matchers should be placed in the internal/testtypes package.

This issue is being worked on in parallel with #5137 and a short discussion about the custom matchers is here

/kind feature

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 26, 2021
@killianmuldoon
Copy link
Contributor Author

/area testing
/area topology
/assign

@fabriziopandini
Copy link
Member

fabriziopandini commented Aug 26, 2021

Other use cases to be considered:

  • Real API server setting uid, creation timestamp, etc. etc.
  • Webhooks applying defaults
  • Controller setting status (and in some cases spec), labels, annotations or finalisers

@k8s-ci-robot k8s-ci-robot added this to the v0.3 milestone Aug 26, 2021
@vincepri
Copy link
Member

/milestone v0.4

@killianmuldoon
Copy link
Contributor Author

Fixed by #5259

@killianmuldoon killianmuldoon added the area/clusterclass Issues or PRs related to clusterclass label May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/clusterclass Issues or PRs related to clusterclass area/testing Issues or PRs related to testing kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
4 participants