-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
secretmanager/api/SecretManager.Samples.Tests/AccessRegionalSecretVersionTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/AddRegionalSecretVersionTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/CreateRegionalSecretTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples/EnableRegionalSecretVersion.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/DeleteRegionalSecretWithEtagTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/DisableRegionalSecretVersionWithEtagTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/ListRegionalSecretVersionsTests.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/ListRegionalSecretVersionsWithFilterTests.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/ListRegionalSecretsTests.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/ListRegionalSecretsWithFilterTests.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples/UpdateRegionalSecretWithAlias.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/UpdateRegionalSecretWithAliasTests.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/UpdateRegionalSecretWithEtagTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples/ListRegionalSecretVersions.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples/ListRegionalSecretVersionsWithFilter.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples/ListRegionalSecretsWithFilter.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples/UpdateRegionalSecretWithAlias.cs
Show resolved
Hide resolved
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.
@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!
7cd6ee3
to
a66a598
Compare
Have rebased this PR on main. Sorry for the inconvenience. |
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.
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.
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples/AccessRegionalSecretVersion.cs
Outdated
Show resolved
Hide resolved
public void CreatesRegionalSecrets() | ||
{ | ||
// Get the SecretName from the set ProjectId & LocationId. | ||
SecretName secretName = _fixture.SecretToCreateName; |
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.
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.
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.
I will create the secret here separetly as mentioned for tests.
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.
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.
secretmanager/api/SecretManager.Samples.Tests/EditRegionalSecretAnnotationsTests.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/IamRegionalGrantAccessTests.cs
Outdated
Show resolved
Hide resolved
[Fact] | ||
public void GrantsAccess() | ||
{ | ||
SecretName secretName = _fixture.SecretToCreateName; |
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.
I think you forgot to change this one.
secretmanager/api/SecretManager.Samples.Tests/UpdateRegionalSecretWithAliasTests.cs
Show resolved
Hide resolved
8ee91ca
to
56c7795
Compare
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.
@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.
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.
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; |
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.
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.
@amanda-tarafa I will update it, can you mention if the style can be due to different dotnet version being used? |
9fd2d39
to
17bb7e4
Compare
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.
Thanks for all the fixes!
Changes
RegionalSecretManagerFixture.cs
file for testing the regional code samples added.