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

Move lookupEntityAliasId() to the entity package #1552

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

benashz
Copy link
Contributor

@benashz benashz commented Jul 26, 2022

Updates the lookupEntityAliasId() to be more like entity.FindAliases(),
and adds unit tests.

Renamed to LookupEntityAlias()

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Relates #1517

Release note for CHANGELOG:


Output from acceptance testing:

$ make testacc-ent TESTARGS='-v -test.run TestAccIdenti -test.count=1'
make testacc TF_ACC_ENTERPRISE=1
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test -v -v -test.run TestAccIdenti -test.count=1 -timeout 30m ./...

=== RUN   TestAccIdentityEntityAlias
--- PASS: TestAccIdentityEntityAlias (2.27s)
=== RUN   TestAccIdentityEntityAliasDuplicateFlow
--- PASS: TestAccIdentityEntityAliasDuplicateFlow (5.15s)
=== RUN   TestAccIdentityEntityAlias_Update
--- PASS: TestAccIdentityEntityAlias_Update (2.11s)
=== RUN   TestAccIdentityEntityAlias_Metadata
--- PASS: TestAccIdentityEntityAlias_Metadata (2.15s)
=== RUN   TestAccIdentityEntityPoliciesExclusive
--- PASS: TestAccIdentityEntityPoliciesExclusive (1.97s)
=== RUN   TestAccIdentityEntityPoliciesNonExclusive
--- PASS: TestAccIdentityEntityPoliciesNonExclusive (2.04s)
=== RUN   TestAccIdentityEntity
--- PASS: TestAccIdentityEntity (1.06s)
=== RUN   TestAccIdentityEntityUpdate
--- PASS: TestAccIdentityEntityUpdate (1.93s)
=== RUN   TestAccIdentityEntityUpdateRemoveValues
--- PASS: TestAccIdentityEntityUpdateRemoveValues (1.88s)
=== RUN   TestAccIdentityEntityUpdateRemovePolicies
--- PASS: TestAccIdentityEntityUpdateRemovePolicies (1.89s)
=== RUN   TestAccIdentityGroupAlias
--- PASS: TestAccIdentityGroupAlias (1.25s)
=== RUN   TestAccIdentityGroupAliasUpdate
--- PASS: TestAccIdentityGroupAliasUpdate (2.16s)
=== RUN   TestAccIdentityGroupMemberEntityIdsExclusiveEmpty
--- PASS: TestAccIdentityGroupMemberEntityIdsExclusiveEmpty (2.92s)
=== RUN   TestAccIdentityGroupMemberEntityIdsExclusive
--- PASS: TestAccIdentityGroupMemberEntityIdsExclusive (2.09s)
=== RUN   TestAccIdentityGroupMemberEntityIdsNonExclusiveEmpty
--- PASS: TestAccIdentityGroupMemberEntityIdsNonExclusiveEmpty (3.04s)
=== RUN   TestAccIdentityGroupMemberEntityIdsNonExclusive
--- PASS: TestAccIdentityGroupMemberEntityIdsNonExclusive (3.00s)
=== RUN   TestAccIdentityGroupMemberEntityIdsDynamic
--- PASS: TestAccIdentityGroupMemberEntityIdsDynamic (5.65s)
=== RUN   TestAccIdentityGroupPoliciesExclusive
--- PASS: TestAccIdentityGroupPoliciesExclusive (1.98s)
=== RUN   TestAccIdentityGroupPoliciesNonExclusive
--- PASS: TestAccIdentityGroupPoliciesNonExclusive (2.00s)
=== RUN   TestAccIdentityGroup
--- PASS: TestAccIdentityGroup (1.05s)
=== RUN   TestAccIdentityGroupUpdate
--- PASS: TestAccIdentityGroupUpdate (4.60s)
=== RUN   TestAccIdentityGroupExternal
--- PASS: TestAccIdentityGroupExternal (1.07s)
=== RUN   TestAccIdentityGroup_DuplicateCreate
--- PASS: TestAccIdentityGroup_DuplicateCreate (0.66s)
=== RUN   TestAccIdentityOIDCAssignment
--- PASS: TestAccIdentityOIDCAssignment (2.71s)
=== RUN   TestAccIdentityOIDCClient
--- PASS: TestAccIdentityOIDCClient (2.23s)
=== RUN   TestAccIdentityOidcKeyAllowedClientId
--- PASS: TestAccIdentityOidcKeyAllowedClientId (3.64s)
=== RUN   TestAccIdentityOidcKey
--- PASS: TestAccIdentityOidcKey (1.98s)
=== RUN   TestAccIdentityOidcKeyUpdate
--- PASS: TestAccIdentityOidcKeyUpdate (3.77s)
=== RUN   TestAccIdentityOIDCProvider
--- PASS: TestAccIdentityOIDCProvider (1.38s)
=== RUN   TestAccIdentityOidcRole
--- PASS: TestAccIdentityOidcRole (1.98s)
=== RUN   TestAccIdentityOidcRoleWithClientId
--- PASS: TestAccIdentityOidcRoleWithClientId (1.77s)
=== RUN   TestAccIdentityOidcRoleUpdate
--- PASS: TestAccIdentityOidcRoleUpdate (3.28s)
=== RUN   TestAccIdentityOIDCScope
--- PASS: TestAccIdentityOIDCScope (1.91s)
=== RUN   TestAccIdentityOidc
--- PASS: TestAccIdentityOidc (1.89s)
PASS
ok      github.com/hashicorp/terraform-provider-vault/vault     82.724s

$ go test -v ./internal/identity/entity            
=== RUN   TestFindAliases
=== PAUSE TestFindAliases
=== RUN   TestLookupEntityAlias
=== PAUSE TestLookupEntityAlias
=== CONT  TestFindAliases
=== RUN   TestFindAliases/empty
=== CONT  TestLookupEntityAlias
=== RUN   TestLookupEntityAlias/alice
=== RUN   TestFindAliases/all
=== RUN   TestLookupEntityAlias/bob
=== RUN   TestLookupEntityAlias/none
=== RUN   TestFindAliases/name-only
=== RUN   TestLookupEntityAlias/error-empty-name
=== RUN   TestLookupEntityAlias/error-empty-mount-accessor
=== RUN   TestLookupEntityAlias/error-on-read
--- PASS: TestLookupEntityAlias (0.01s)
    --- PASS: TestLookupEntityAlias/alice (0.00s)
    --- PASS: TestLookupEntityAlias/bob (0.00s)
    --- PASS: TestLookupEntityAlias/none (0.00s)
    --- PASS: TestLookupEntityAlias/error-empty-name (0.00s)
    --- PASS: TestLookupEntityAlias/error-empty-mount-accessor (0.00s)
    --- PASS: TestLookupEntityAlias/error-on-read (0.00s)
=== RUN   TestFindAliases/name-and-mount-accessor
=== RUN   TestFindAliases/mount-accessor-mismatch
=== RUN   TestFindAliases/error-on-list
=== RUN   TestFindAliases/error-on-read
--- PASS: TestFindAliases (7.98s)
    --- PASS: TestFindAliases/empty (0.00s)
    --- PASS: TestFindAliases/all (0.00s)
    --- PASS: TestFindAliases/name-only (0.00s)
    --- PASS: TestFindAliases/name-and-mount-accessor (0.00s)
    --- PASS: TestFindAliases/mount-accessor-mismatch (0.00s)
    --- PASS: TestFindAliases/error-on-list (4.06s)
    --- PASS: TestFindAliases/error-on-read (3.91s)
PASS
ok      github.com/hashicorp/terraform-provider-vault/internal/identity/entity  8.219s



Updates the lookupEntityAliasId() to be more like entity.FindAliases(),
and adds unit tests.
@benashz benashz added this to the 3.8.0 milestone Jul 26, 2022
Copy link
Contributor

@vinay-gopalan vinay-gopalan left a comment

Choose a reason for hiding this comment

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

LGTM!

@benashz benashz merged commit 645546e into main Jul 26, 2022
@benashz benashz deleted the VAULT-6839/generalize-lookup-entity-alias branch July 26, 2022 17:06
marcboudreau pushed a commit to marcboudreau/terraform-provider-vault that referenced this pull request Nov 6, 2022
Updates the lookupEntityAliasId() to be more like entity.FindAliases(),
and adds unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants