Skip to content

CLOUDP-62054: replace mock generation in make with go generate #187

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 2 commits into from
May 25, 2020

Conversation

gssbzn
Copy link
Collaborator

@gssbzn gssbzn commented May 25, 2020

Proposed changes

Jira ticket: CLOUDP-62054

Closes #[issue number]

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code

@gssbzn gssbzn requested a review from andreaangiolillo May 25, 2020 16:59
We use [mockgen](https://github.com/golang/mock) to handle mocking in our unit tests
If you need a new mock please add a reference on the [Make](Makefile) file and run `make gen-mocks`
We use [mockgen](https://github.com/golang/mock) to handle mocking in our unit tests.
If you need a new mock please update or add the `//go:generate` instruction to the appropriate file
Copy link
Collaborator

Choose a reason for hiding this comment

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

💯

@@ -30,6 +33,36 @@ type HostDescriber interface {
Host(string, string) (*opsmngr.Host, error)
}

type HostDatabaseLister interface {
Copy link
Collaborator

@andreaangiolillo andreaangiolillo May 25, 2020

Choose a reason for hiding this comment

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

I don't think this should be part of this PR. You don't have to change it, it is just my opinion since this doesn't seem related to the scope of the PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the reason I did it was to group the related methods and thus reducing the files to tag with go generate, if you check they all use the same opsmngr. Deployments module, this changed on the client but we never updated the file grouping so here I'm doing that, but to your point yes, they could've been a separate PR

@@ -23,10 +23,26 @@ import (
"go.mongodb.org/ops-manager/opsmngr"
)

//go:generate mockgen -destination=../mocks/mock_measurements.go -package=mocks github.com/mongodb/mongocli/internal/store HostMeasurementLister,HostDiskMeasurementsLister

type HostMeasurementLister interface {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM

@gssbzn gssbzn merged commit 9628218 into master May 25, 2020
@gssbzn gssbzn deleted the CLOUDP-62054 branch May 25, 2020 17:18
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 this pull request may close these issues.

2 participants