From edff3dce66b227863f04dea45a8bf7f00988afad Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sat, 5 Aug 2017 22:31:40 -0400 Subject: Adding a couple extra integration tests for vault Signed-off-by: Dave Henderson --- test/integration/datasources_vault.bats | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test/integration/datasources_vault.bats b/test/integration/datasources_vault.bats index e4fa6b1e..aa6e27f3 100644 --- a/test/integration/datasources_vault.bats +++ b/test/integration/datasources_vault.bats @@ -140,6 +140,24 @@ function teardown () { [[ "${output}" == "10.1.2.3" ]] } +@test "Testing vault auth with dynamic secret using prefix and options in URL" { + vault mount ssh + vault write ssh/roles/test key_type=otp default_user=user cidr_list=10.0.0.0/8 + VAULT_TOKEN=$(vault token-create -format=json -policy=writepol -use-limit=2 -ttl=1m | jq -j .auth.client_token) + VAULT_TOKEN=$VAULT_TOKEN gomplate -d vault=vault:///ssh/creds/test?ip=10.1.2.3\&username=user -i '{{(datasource "vault").ip}}' + [ "$status" -eq 0 ] + [[ "${output}" == "10.1.2.3" ]] +} + +@test "Testing vault auth with dynamic secret using options in URL and path in template" { + vault mount ssh + vault write ssh/roles/test key_type=otp default_user=user cidr_list=10.0.0.0/8 + VAULT_TOKEN=$(vault token-create -format=json -policy=writepol -use-limit=2 -ttl=1m | jq -j .auth.client_token) + VAULT_TOKEN=$VAULT_TOKEN gomplate -d vault=vault:///?ip=10.1.2.3\&username=user -i '{{(datasource "vault" "ssh/creds/test").ip}}' + [ "$status" -eq 0 ] + [[ "${output}" == "10.1.2.3" ]] +} + # TODO: test the github auth backend at some point... this needs a github token though, so... # vault write auth/github/config organization=DockerOttawaMeetup # vault write auth/github/map/teams/organizers value=pol -- cgit v1.2.3