Skip to content

doc/user/unit-testing.md: explain fake client and unit test example #757

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

Merged
merged 3 commits into from
Nov 28, 2018

Conversation

estroz
Copy link
Member

@estroz estroz commented Nov 16, 2018

Description of the change: doc on using controller-runtime's fake client library to mock API calls in unit tests.

Motivation for the change: users should be writing unit tests for custom operator code. The fake client is useful for doing so.

@estroz estroz added area/testing Issue related to testing the operator-sdk and subcomponents docs labels Nov 16, 2018
@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 16, 2018
@estroz estroz force-pushed the fake-client branch 2 times, most recently from d4c5a6e to 0459cad Compare November 16, 2018 23:57
@estroz
Copy link
Member Author

estroz commented Nov 20, 2018

The unit test here is less thorough than that in operator-sdk-samples for brevity's sake. I'm adding a link in this doc to that test if users want to see the unabridged version.

Copy link
Contributor

@hasbro17 hasbro17 left a comment

Choose a reason for hiding this comment

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

LGTM after nit.

@estroz estroz merged commit e74dd32 into operator-framework:master Nov 28, 2018
@estroz estroz deleted the fake-client branch November 28, 2018 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Issue related to testing the operator-sdk and subcomponents size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants