Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

docs: add mocking info to unit testing guide #1666

Merged
merged 1 commit into from
Sep 4, 2020

Conversation

shashankram
Copy link
Member

Resolves #1649

Signed-off-by: Shashank Ram shashank08@gmail.com

  • New Functionality [ ]
  • Documentation [X]
  • Install [ ]
  • Control Plane [ ]
  • CLI Tool [ ]
  • Certificate Management [ ]
  • Networking [ ]
  • Metrics [ ]
  • SMI Policy [ ]
  • Security [ ]
  • Tests / CI System [ ]
  • Other [ ]

Please answer the following questions with yes/no.

  • Does this change contain code from or inspired by another project? If so, did you notify the maintainers and provide attribution?

Resolves openservicemesh#1649

Signed-off-by: Shashank Ram <shashank08@gmail.com>
@shashankram shashankram requested a review from a team as a code owner September 4, 2020 17:51
As an example, to create a mock client for the `Configurator` interface defined in the [configurator](/pkg/configurator) package:
```bash
mockgen -destination=pkg/configurator/mock_client.go -package=configurator github.com/openservicemesh/osm/pkg/configurator Configurator
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you either add to this PR or follow up with a change to include this package in tools.go at the root of the repo and update the instructions to use go run ... to invoke the generator? That way we can track the version we're using and there's no extra step required to get the mockgen binary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do in a follow-up.

Copy link
Contributor

@draychev draychev left a comment

Choose a reason for hiding this comment

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

Thanks for documenting this!

@shashankram shashankram merged commit 8139187 into openservicemesh:main Sep 4, 2020
@shashankram shashankram deleted the mock-doc branch September 4, 2020 18:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how mocks are generated for unit testing
4 participants