-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
chore: Add SecretManager service regional code samples #2880
base: main
Are you sure you want to change the base?
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.
Please rebase this PR on main as at the moment your branch is outdated and this PR is including unrelated Secret Manager changes.
There are several comments that although left in one or two files only, should be addressed everywhere.
I aslo have some concerns about:
- assumptions that tests run in a given order
- assumptions that tests do not run in parallel
- reuse of fxiture resources in tests that modify said resources
All of these may be addressed by creating specific resources for each of the tests that modify the resources. And ideally those should be set up and deleted on each of the tests using the fixture methods as helpers. Shares resources in the fixture should only be used for tests that do not modify those resources. I know some of this was inspired by the existing global samples, but, although those are not perfect, there are way less of them that are modifying resources, and certainly not relying on the eTag for optimistic concurrent updates. This PR as is will be flaky.
Also, the code doesn't currently build, there's a type in a variable name.
secretmanager/api/SecretManager.Samples.Tests/UpdateRegionalSecretWithEtagTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/RegionalSecretManagerFixture.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples/EnableRegionalSecretVersionWithEtag.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/EnableRegionalSecretVersionWithEtagTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/DisableRegionalSecretVersionWithEtagTests.cs
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/DestroyRegionalSecretVersionWithEtagTests.cs
Outdated
Show resolved
Hide resolved
secretmanager/api/SecretManager.Samples.Tests/DeleteRegionalSecretTests.cs
Outdated
Show resolved
Hide resolved
Have made the changes in the file as per the suggestion, thanks for pointing it out. |
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
secretmanager/api/SecretManager.Samples.Tests/CreateRegionalSecretTests.cs
Show resolved
Hide resolved
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
a66a598
to
8ee91ca
Compare
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.
Changes
RegionalSecretManagerFixture.cs
file for testing the regional code samples added.