Skip to content

Commit d7f7118

Browse files
committed
Merge pull request #1702 from mboersma/test-scripts-in-git
ref(tests): move test scripts under tests/bin
2 parents 55f53ac + 45ee689 commit d7f7118

7 files changed

Lines changed: 102 additions & 0 deletions

tests/bin/build-deis-cli.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
#
3+
# Creates a python virtual environment and builds the `deis` client binary with it.
4+
5+
virtualenv --system-site-packages venv
6+
. venv/bin/activate
7+
pip install docopt==0.6.2 python-dateutil==2.2 PyYAML==3.11 requests==2.3.0 pyinstaller==2.1
8+
make -C client/ client

tests/bin/destroy-all-vagrants.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
#
3+
# WARNING: Don't run this script unless you understand that it will destroy all Deis vagrant VMs.
4+
#
5+
# Tells vagrant to destroy all VMs with "deis" in the name.
6+
7+
VMS=$(vagrant global-status | grep deis | awk '{ print $5 }')
8+
for dir in $VMS; do
9+
cd $dir && vagrant destroy --force
10+
done

tests/bin/git-ssh-nokeycheck.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
#
3+
# Allows git to exec SSH but bypass auth warnings.
4+
# To use, export the environment variable GIT_SSH as the location of this script,
5+
# then run git commands as usual:
6+
# $ export GIT_SSH=$HOME/bin/git-ssh-nokeycheck.sh
7+
8+
SSH_ORIGINAL_COMMAND="ssh $@"
9+
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@"

tests/bin/halt-all-vagrants.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
#
3+
# Tells vagrant to halt all running VMs with "deis" in the name.
4+
5+
RUNNING_VMS=$(vagrant global-status | grep deis | grep running | awk '{ print $5 }')
6+
for dir in $RUNNING_VMS; do
7+
cd $dir && vagrant halt
8+
done

tests/bin/prime-docker-images.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
#
3+
# WARNING: Don't run this script unless you understand that it will remove all Docker items.
4+
#
5+
# Purges *all* Docker containers and images from the local graph, then pulls down a set of
6+
# images to help tests run faster.
7+
8+
# Remove all Dockernalia
9+
docker kill `docker ps -q`
10+
docker rm `docker ps -a -q`
11+
docker rmi -f `docker images -q`
12+
13+
# Pull Deis testing essentials
14+
docker pull deis/base:latest
15+
docker pull deis/slugbuilder:latest
16+
docker pull deis/slugrunner:latest
17+
docker pull deis/test-etcd:latest
18+
docker pull paintedfox/postgresql:latest

tests/bin/start-node.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
#
3+
# Connects this machine as a Jenkins node to http://ci.deis.io/
4+
# Set NODE_NAME and NODE_SECRET to the values provided by Jenkins in the "Manage Nodes"
5+
# administrative interface.
6+
7+
wget -N http://ci.deis.io/jnlpJars/slave.jar
8+
java -jar slave.jar -jnlpUrl http://ci.deis.io/computer/${NODE_NAME?}/slave-agent.jnlp -secret ${NODE_SECRET?} &

tests/bin/test-integration.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
#
3+
# Preps a test environment and runs `make test-integration` with single-node vagrant.
4+
5+
echo Testing ${DEIS_TEST_APP?}...
6+
7+
# Environment reset and configuration
8+
rm -rf ~/.deis ~/.fleetctl ~/.ssh/known_hosts
9+
ssh-add -D || eval $(ssh-agent) && ssh-add -D
10+
ssh-add ~/.vagrant.d/insecure_private_key
11+
ssh-add ~/.ssh/deis
12+
cd ${GOPATH?}/src/github.com/deis/deis
13+
rm -rf tests/example-*
14+
15+
# Vagrant provisioning
16+
tests/bin/halt-all-vagrant.sh
17+
vagrant destroy --force
18+
vagrant up --provider virtualbox --provision
19+
20+
# Trap exit signal to halt vagrant
21+
function cleanup {
22+
set +e
23+
make stop
24+
vagrant halt
25+
}
26+
trap cleanup EXIT
27+
28+
set -e
29+
30+
# Build updated Deis CLI and use it for testing
31+
virtualenv --system-site-packages venv
32+
. venv/bin/activate
33+
pip install docopt==0.6.2 python-dateutil==2.2 PyYAML==3.11 requests==2.3.0 pyinstaller==2.1
34+
make -C client/ client
35+
chmod +x client/dist/deis
36+
export PATH=`pwd`/client/dist:$PATH
37+
38+
# Install Deis and run tests
39+
make build
40+
make run
41+
make test-integration

0 commit comments

Comments
 (0)