Skip to content

chore: Add SecretManager service regional code samples #2880

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 7 commits into from
Mar 17, 2025

Conversation

YashSaraf11
Copy link
Contributor

Changes

  • Added code samples for regional APIs.
  • Added test files for the regional code samples added.
  • Added RegionalSecretManagerFixture.cs file for testing the regional code samples added.

@YashSaraf11 YashSaraf11 requested review from a team as code owners December 23, 2024 09:28
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Dec 23, 2024
Copy link

snippet-bot bot commented Dec 23, 2024

Here is the summary of changes.

You are about to add 28 region tags.

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

@amanda-tarafa amanda-tarafa assigned amanda-tarafa and unassigned jskeet Jan 6, 2025
@YashSaraf11 YashSaraf11 requested review from a team as code owners February 12, 2025 09:53
vipul7499
vipul7499 previously approved these changes Feb 13, 2025
@amanda-tarafa amanda-tarafa removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Feb 18, 2025
Copy link
Member

@amanda-tarafa amanda-tarafa left a comment

Choose a reason for hiding this comment

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

@YashSaraf11 Can you rebase this PR on main? It now has accumulated changes for other products with changes in over 160 files, and it's very hard to review. Thanks!

@YashSaraf11
Copy link
Contributor Author

@YashSaraf11 Can you rebase this PR on main? It now has accumulated changes for other products with changes in over 160 files, and it's very hard to review. Thanks!

Have rebased this PR on main. Sorry for the inconvenience.

Copy link
Member

@amanda-tarafa amanda-tarafa left a comment

Choose a reason for hiding this comment

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

This is looking good in terms of possible flakiness because of resource sharing across tests. I think there a couple of tests that still need updating, I've called those out. Thanks!

There are a couple other comments for sample code simplification.

And there are the style comments, about the new-line parenthesis and indents. Those are off. I replied to your comment about dotnet format. We should fix these at least in sample code, it happens in some tests as well, because it's really an unfamiliar style.

public void CreatesRegionalSecrets()
{
// Get the SecretName from the set ProjectId & LocationId.
SecretName secretName = _fixture.SecretToCreateName;
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need a SecretToCreateName here? Can't you just create a secret with a random ID? This makes it look like this secret will be used somewhere else, but that's really not possible because we can't rely on tests executing in any given order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will create the secret here separetly as mentioned for tests.

Copy link
Member

Choose a reason for hiding this comment

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

I think you forgot to push a commit. This is not done yet. Also, once you've changed this, it's likely that you can delete SecretToCreateName from the fixture.

[Fact]
public void GrantsAccess()
{
SecretName secretName = _fixture.SecretToCreateName;
Copy link
Member

Choose a reason for hiding this comment

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

I think you forgot to change this one.

@YashSaraf11 YashSaraf11 force-pushed the add-regional-samples branch 2 times, most recently from 8ee91ca to 56c7795 Compare March 11, 2025 14:28
Copy link
Contributor Author

@YashSaraf11 YashSaraf11 left a comment

Choose a reason for hiding this comment

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

@amanda-tarafa
Thanks for the detailed review! I've incorporated your feedback and fixed the dotnet format issues.
I also looked into the secret updates. As you mentioned, they're updating different pieces and don't affect the tests.

I believe I've addressed all your points, but please let me know if anything else comes up.

Copy link
Member

@amanda-tarafa amanda-tarafa left a comment

Choose a reason for hiding this comment

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

There's still one of the secret names that is shared when it shouldn't. I've flagged it.

Also, style is still off in some tests. What IDE are you using?

public void CreatesRegionalSecrets()
{
// Get the SecretName from the set ProjectId & LocationId.
SecretName secretName = _fixture.SecretToCreateName;
Copy link
Member

Choose a reason for hiding this comment

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

I think you forgot to push a commit. This is not done yet. Also, once you've changed this, it's likely that you can delete SecretToCreateName from the fixture.

@YashSaraf11
Copy link
Contributor Author

YashSaraf11 commented Mar 13, 2025

There's still one of the secret names that is shared when it shouldn't. I've flagged it.

Also, style is still off in some tests. What IDE are you using?

@amanda-tarafa I will update it, can you mention if the style can be due to different dotnet version being used?
Have dmed to track this faster, will add the changes together with the styling fix post discussion.

@YashSaraf11 YashSaraf11 requested a review from a team as a code owner March 17, 2025 11:10
@YashSaraf11 YashSaraf11 force-pushed the add-regional-samples branch from 9fd2d39 to 17bb7e4 Compare March 17, 2025 11:17
Copy link
Member

@amanda-tarafa amanda-tarafa 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 all the fixes!

@amanda-tarafa amanda-tarafa merged commit d9c2a6b into main Mar 17, 2025
10 checks passed
@amanda-tarafa amanda-tarafa deleted the add-regional-samples branch March 17, 2025 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants