-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun-tests.sh
executable file
·31 lines (31 loc) · 1013 Bytes
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
# Run the tests. Note: requires bats to be installed.
set -o allexport
if [[ -z $ADFS_PASSWORD ]]; then
read -sp 'ADFS Password: ' ADFS_PASSWORD
printf >&2 '\n'
fi
if [[ -z $TEST_ACCOUNT ]]; then
read -p 'AWS account name for tests: ' TEST_ACCOUNT
fi
if [[ -z $TEST_ACCOUNT2 ]]; then
read -p 'Another AWS account name for tests: ' TEST_ACCOUNT2
fi
if [[ -z $TEST_ROLE ]]; then
read -p 'IAM role name for tests: ' TEST_ROLE
fi
# Make sure no AWS_ vars will mess up our tests
unset $( export | sed -ne '/^declare -x AWS_/{;s/^declare -x //;s/=.*//;p;}' )
TEST_ROOT=/tmp/samlkeygen-tests-$$
mkdir -p "$TEST_ROOT/bin"
AWS_DIR=$TEST_ROOT/aws
AWS_SHARED_CREDENTIALS_FILE=$AWS_DIR/credentials
PATH=$TEST_ROOT/bin:$PATH
pip install --ignore-installed --prefix="$TEST_ROOT" . awscli
export PYTHONPATH=$(echo "$TEST_ROOT"/lib/python*/site-packages)
if ./tests.bats; then
# all tests succeeded
rm -rf "$TEST_ROOT"
else
printf 'Test results left in %s\n' "$TEST_ROOT"
fi