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

feat: create shared reservation #4378

Merged
merged 8 commits into from
Oct 13, 2024

Conversation

BigBlackWolf
Copy link
Contributor

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed Contributing Guidelines from CONTRIBUTING.MD
  • Tests pass: go test -v ./.. (see Testing)
  • Code formatted: gofmt (see Formatting)
  • Vetting pass: go vet (see Formatting)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Sep 13, 2024
@BigBlackWolf BigBlackWolf force-pushed the feat_compute_reservation_create_shared branch 2 times, most recently from bd78b5c to 6ab37f6 Compare September 13, 2024 16:14
@BigBlackWolf BigBlackWolf added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. and removed kokoro:run Add this label to force Kokoro to re-run the tests. labels Sep 13, 2024
@BigBlackWolf BigBlackWolf force-pushed the feat_compute_reservation_create_shared branch from 6ab37f6 to c8957a2 Compare September 16, 2024 12:28
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 16, 2024
@BigBlackWolf BigBlackWolf marked this pull request as ready for review September 16, 2024 17:32
@BigBlackWolf BigBlackWolf requested review from a team as code owners September 16, 2024 17:32
@BigBlackWolf BigBlackWolf enabled auto-merge (squash) September 16, 2024 17:32
Copy link

snippet-bot bot commented Sep 16, 2024

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Copy link
Collaborator

@telpirion telpirion left a 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?

@telpirion telpirion self-assigned this Sep 17, 2024
@BigBlackWolf
Copy link
Contributor Author

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
cc: @m-strzelczyk

"google.golang.org/protobuf/proto"
)

type ClientInterface interface {
Copy link
Member

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

Copy link
Contributor Author

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

@telpirion telpirion added the api: compute Issues related to the Compute Engine API. label Oct 10, 2024
@BigBlackWolf BigBlackWolf added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 13, 2024
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 13, 2024
@BigBlackWolf BigBlackWolf merged commit 1cd7a6f into main Oct 13, 2024
11 checks passed
@BigBlackWolf BigBlackWolf deleted the feat_compute_reservation_create_shared branch October 13, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: compute Issues related to the Compute Engine API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants