mirror of
https://github.com/hashicorp/vault-action.git
synced 2026-04-07 12:39:26 +00:00
feat: add support for (nearly) any engine (#15)
* feat: add support for (nearly) any engine * cache response and fixup data depth logic * use starting slash as non-kv sentinel value * add tests for custom engines * improve docs and add descriptor of generic support * update dist
This commit is contained in:
parent
f229481670
commit
0188d9d223
8 changed files with 238 additions and 70 deletions
|
|
@ -171,4 +171,40 @@ describe('integration', () => {
|
|||
|
||||
expect(core.exportVariable).toBeCalledWith('OTHERSECRET', 'OTHERCUSTOMSECRET');
|
||||
});
|
||||
|
||||
describe('generic engines', () => {
|
||||
beforeAll(async () => {
|
||||
await got(`${vaultUrl}/v1/cubbyhole/test`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-Vault-Token': 'testtoken',
|
||||
},
|
||||
json: {
|
||||
foo: "bar",
|
||||
zip: "zap"
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('supports cubbyhole', async () => {
|
||||
mockInput('/cubbyhole/test foo');
|
||||
|
||||
await exportSecrets();
|
||||
|
||||
expect(core.exportVariable).toBeCalledWith('FOO', 'bar');
|
||||
});
|
||||
|
||||
it('caches responses', async () => {
|
||||
mockInput(`
|
||||
/cubbyhole/test foo ;
|
||||
/cubbyhole/test zip`);
|
||||
|
||||
await exportSecrets();
|
||||
|
||||
expect(core.debug).toBeCalledWith('ℹ using cached response');
|
||||
|
||||
expect(core.exportVariable).toBeCalledWith('FOO', 'bar');
|
||||
expect(core.exportVariable).toBeCalledWith('ZIP', 'zap');
|
||||
});
|
||||
})
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue