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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up testcontainers + add readme example as test #65

Closed
wants to merge 4 commits into from

Conversation

dhuckins
Copy link
Contributor

@dhuckins dhuckins commented Oct 17, 2022

Description

wanted to try out the client, to do it as a test makes sense to me 馃し

had to get cap-add into testcontainers-go

Don't forget to

- [ ] run make regen not needed

Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>
Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>
@dhuckins dhuckins marked this pull request as ready for review October 17, 2022 15:09
@dhuckins dhuckins requested a review from a team October 17, 2022 15:09

vault, err := setupVaultContainer(ctx, rootToken)
require.NoError(t, err)
defer vault.Terminate(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd be interested in seeing how long it takes to bring up / shut down the Vault container. If we have one container per test, it may make sense to just have a few long-running containers for the entire test suite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

once it was pulled (most of the time was spent downloading/extracting image), only a second or two to run!
lifetime of the container would definitely depend on the test
if you notice, the port mapping isn't a 1-to-1 (8200 doesn't map to 8200 local) so you can run tests in parallel

}

_, err = client.Write(ctx, secretPath, map[string]interface{}{
"data": expected, // TODO: is this key always `data`?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, for KVv2, the "data" element is part of the protocol (unfortunately). To address the confusion, we have introduced KV wrappers in the original vault/api library. The plan is to add something similar here at some point :)

golang.org/x/exp v0.0.0-20220921164117-439092de6870
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a bit concerned about the number of indirect dependencies we are pulling with testcontainers. This was one of the complaints we received about the original vault/api library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah... was going to make a comment
looks like testcontainers-go has some stuff that's probably not needed https://github.com/testcontainers/testcontainers-go/blob/d9bb48832213a363800e10b88d41e57a59447ccb/go.mod

for our immediate use-case, we can put in something like internal/tests and have a separate go.mod

@dhuckins dhuckins closed this Feb 16, 2023
@dhuckins dhuckins deleted the dh/testcontainers branch February 16, 2023 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants