-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat: create shared reservation #4378
Conversation
bd78b5c
to
6ab37f6
Compare
6ab37f6
to
c8957a2
Compare
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: why are we mocking the client?
Hey! It was a request to do in this way, because without mocking it would be needed to set up one more project in CI |
"google.golang.org/protobuf/proto" | ||
) | ||
|
||
type ClientInterface interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: Is this used only for mocking
the client? Is there a way to make a sample fully standalone (it should initialise the client), but still mock the client when running tests?
See my example in Python (different sample): GoogleCloudPlatform/python-docs-samples#12598
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's done this way to allow for either real or mocked client. I tried to do it in a mocking way without modifying the sample, but in Go it couldn't be done as in Python or Java...
Go doesn't support object replacement in runtime, so the typical solution for that is to make an abstraction (interface) that matches the same signature. I tried to cover the gap in comments to explain how it can be done by the developer, who will run this sample, but agree that it doesn't seem ideal.
Perhaps I am missing something - I am open to any suggestions on how to improve it
Description
Fixes #
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
go test -v ./..
(see Testing)gofmt
(see Formatting)go vet
(see Formatting)