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

api: add wrapper functions for GET auth and mount #25499

Merged
merged 7 commits into from
Feb 20, 2024
Merged

Conversation

fairclothjm
Copy link
Contributor

@fairclothjm fairclothjm commented Feb 16, 2024

@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Feb 16, 2024
@fairclothjm fairclothjm added this to the 1.16.0-rc2 milestone Feb 16, 2024
Copy link

github-actions bot commented Feb 16, 2024

CI Results:
All Go tests succeeded! ✅

Copy link

github-actions bot commented Feb 16, 2024

Build Results:
All builds succeeded! ✅

@fairclothjm fairclothjm changed the title api: add GET for auth and mount api: add wrapper functions for GET auth and mount Feb 16, 2024
Copy link
Contributor

@austingebauer austingebauer left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@benashz benashz left a comment

Choose a reason for hiding this comment

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

Seems good. Would be great if there could be some corresponding tests.

@fairclothjm
Copy link
Contributor Author

Thanks Ben! I had the same thought and will work on adding some. It doesn't look like there are unit tests for this file so I will see if I should create one or if there are other places where we are testing these API methods. FWIW, we are testing these in TFVP hashicorp/terraform-provider-vault#2145

:)

Comment on lines +15 to +17
func (c *Sys) GetAuth(path string) (*AuthMount, error) {
return c.GetAuthWithContext(context.Background(), path)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this one if we have the one below? From my experience, usually we add the *WithContext and keep the one method without *WithContext for backwards compatibility, but since these are both new, I think we could get away with just having GetAuthWithContext.

With that said, the Vault conventions could be different.

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 had the same question but kept it for consistency.

@@ -9,8 +9,34 @@ import (
"testing"
)

func TestGetMount(t *testing.T) {
mockVaultServer := httptest.NewServer(http.HandlerFunc(mockVaultGetMountHandler))
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to test getting a real mount from a real / test vault server? I think this would mostly be testing the parsing / decoding logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 63344e0

@fairclothjm fairclothjm merged commit 54c28fd into main Feb 20, 2024
83 checks passed
@fairclothjm fairclothjm deleted the api/get-auth-mount branch February 20, 2024 16:31
@fairclothjm fairclothjm modified the milestones: 1.16.0-rc2, 1.16.0 Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants