When implementing new functionality, please check the Vault provider first. If the same functionality is implemented in the Vault provider: Use the same API if there is no good reason to deviate.
Much of the provider is tested using recorded HTTP traffic from interactions
with a real OpenBao server (stored in testdata/http/<TestName>.yaml). This
gives us very realistic tests, which still run in a few milliseconds.
To re-record the traffic, run:
ESO_PROVIDER_OPENBAO_RERECORD=true go test .
This will:
bao to be on your PATH)Before storing the HTTP traffic some cleanup is applied (see getRecorder),
this replaces values that are random (e.g. OpenBao "mount accessors") or
timestamp based (e.g. creation timestamps) with predictable values. While this
is not technically necessary and adds some complexity to the tests, it greatly
improves the readability of the git diff. When you have to rerecord the
traffic, it is recommended to:
ESO_PROVIDER_OPENBAO_RERECORD=truegit add the recordingsESO_PROVIDER_OPENBAO_RERECORD=true, if there are changes in
the recording files, tweak the cleanup logic and go to step 1.ESO_PROVIDER_OPENBAO_RERECORD=true and see if the tests
still pass.While this strategy is good for testing the CRUD operations on secrets, it will not work very well for many Authentication methods, which often work with random strings and might even have explicit replay protections, therefore:
With this setup, we can still run extensive tests on our logic (e.g. token caching) against the UserPass auth method and relying on the OpenBao client to call whatever authentication method we have configured.