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: Introduce Environment Variable for Quota Project Id #1082

Merged
merged 23 commits into from
Nov 30, 2022

Conversation

sai-sunder-s
Copy link
Contributor

@sai-sunder-s sai-sunder-s commented Nov 5, 2022

Introduce a new environment variable "GOOGLE_CLOUD_QUOTA_PROJECT" that can be used to specify a quota project id. This quota project will be used to override the quota project from the credential detected during ADC generation.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the samples format.

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Nov 5, 2022
@sai-sunder-s sai-sunder-s marked this pull request as ready for review November 5, 2022 06:40
@sai-sunder-s sai-sunder-s requested a review from a team as a code owner November 5, 2022 06:40
Copy link
Contributor

@TimurSadykov TimurSadykov left a comment

Choose a reason for hiding this comment

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

Few comments

@sai-sunder-s sai-sunder-s requested a review from a team as a code owner November 18, 2022 08:36
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Nov 18, 2022
@sai-sunder-s sai-sunder-s added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 21, 2022
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 21, 2022
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: l Pull request size is large. labels Nov 21, 2022
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Nov 23, 2022

@Test
public void adcQuotaFromEnv() throws IOException {
GoogleCredentials credentials = GoogleCredentials.getApplicationDefault();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a big fan of this test where the code does not control the success of this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed. Moved this as an assert on env var to the other test

Copy link
Contributor

@TimurSadykov TimurSadykov Nov 30, 2022

Choose a reason for hiding this comment

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

Sorry, for a late comment. I think we better restore the original test. It is not perfect but it adds value by validating the quota project override behavior "in the wild".

The second test only checks that override does not work for explicit value, which is a different test case

Copy link
Contributor

@TimurSadykov TimurSadykov left a comment

Choose a reason for hiding this comment

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

just a question on clirr

Copy link
Contributor

@TimurSadykov TimurSadykov left a comment

Choose a reason for hiding this comment

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

auth bits looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants