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
Conversation
Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>
Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>
|
||
vault, err := setupVaultContainer(ctx, rootToken) | ||
require.NoError(t, err) | ||
defer vault.Terminate(ctx) |
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'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.
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.
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`? |
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.
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 |
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'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.
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.
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
Description
wanted to try out the client, to do it as a test makes sense to me 馃し
had to get
cap-add
into testcontainers-goDon't forget to
- [ ] runnot neededmake regen