Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
馃悰 Make integration tests multiplatform
Browse files Browse the repository at this point in the history
- Integration test setup: update default Vault version to 1.4.1

PR #1
[close ch1055]
  • Loading branch information
dericmiller committed May 11, 2020
1 parent 141c672 commit 61260a6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.MD
Expand Up @@ -36,6 +36,10 @@ If not set, `vaultlib` will fallback to safe default values.

> `vautlib` will automatically use the http_proxy environment variable to connect to Vault
## Tests

To test this library, run `go1.11.13 test -vaultVersion 1.4.1` in the root of the repo.

## Getting Started

> For a simple, working example, check the sample folder.
Expand Down
2 changes: 1 addition & 1 deletion integration_test.go
Expand Up @@ -14,7 +14,7 @@ var vaultRoleID, vaultSecretID, noKVRoleID, noKVSecretID string
var vaultVersion string

func init() {
flag.StringVar(&vaultVersion, "vaultVersion", "1.0.1", "provide vault version to be tested against")
flag.StringVar(&vaultVersion, "vaultVersion", "1.4.1", "provide vault version to be tested against")
flag.Parse()
}
func TestMain(m *testing.M) {
Expand Down
18 changes: 15 additions & 3 deletions test-files/initVaultDev.sh
@@ -1,13 +1,25 @@
#!/bin/bash
export VAULT_ADDR=http://localhost:8200
export VAULT_TOKEN=my-dev-root-vault-token
export VAULT_VERSION=${1:-1.0.1}
export VAULT_VERSION=${1:-1.4.1}

case "$(uname -s)" in
Darwin*)
OS="darwin_amd64"
;;
MINGW64*)
OS="windows_amd64"
;;
*)
OS="linux_amd64"
;;
esac

CURRENT_VAULT=`./vault version | cut -d'v' -f2 | cut -d' ' -f1`
if [ "$CURRENT_VAULT" != "$VAULT_VERSION" ]; then
rm -rf ./vault
curl -kO https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip
unzip vault_${VAULT_VERSION}_linux_amd64.zip
curl -kO https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_${OS}.zip
unzip vault_${VAULT_VERSION}_${OS}.zip
fi

./vault server -dev -dev-root-token-id ${VAULT_TOKEN} > /tmp/vaultdev.log &
Expand Down

0 comments on commit 61260a6

Please sign in to comment.