Run Boulder via docker-compose in tests.

This removes a lot of setup code we used to need in order to get Boulder to run,
and should reduce brittleness of tests based on Boulder changes.

This also unblocks Boulder from upgrading to MariaDB 10.1 in integration tests,
since changing to 10.1 syntax for user creation would break the current certbot
integration tests (which run 10.0).
This commit is contained in:
Jacob Hoffman-Andrews
2016-05-23 18:40:25 -07:00
parent 860ee5c174
commit 2cfcfd6988
4 changed files with 22 additions and 87 deletions
+7 -18
View File
@@ -4,26 +4,18 @@ cache:
directories: directories:
- $HOME/.cache/pip - $HOME/.cache/pip
services: # This makes sure we get a host with docker-compose present.
- rabbitmq dist: trusty
- mariadb
# apacheconftest
#- apache2
# http://docs.travis-ci.com/user/ci-environment/#CI-environment-OS
# gimme has to be kept in sync with Boulder's Go version setting in .travis.yml
before_install: before_install:
- 'dpkg -s libaugeas0' - 'dpkg -s libaugeas0'
- '[ "xxx$BOULDER_INTEGRATION" = "xxx" ] || eval "$(gimme 1.5.1)"'
# using separate envs with different TOXENVs creates 4x1 Travis build # using separate envs with different TOXENVs creates 4x1 Travis build
# matrix, which allows us to clearly distinguish which component under # matrix, which allows us to clearly distinguish which component under
# test has failed # test has failed
env: env:
global: global:
- GOPATH=/tmp/go - BOULDERPATH=$GOPATH/src/github.com/letsencrypt/boulder/
- PATH=$GOPATH/bin:$PATH
- GO15VENDOREXPERIMENT=1 # Fixes problems with vendor directories
matrix: matrix:
include: include:
@@ -93,7 +85,6 @@ addons:
- boulder - boulder
- boulder-mysql - boulder-mysql
- boulder-rabbitmq - boulder-rabbitmq
mariadb: "10.0"
apt: apt:
sources: sources:
- augeas - augeas
@@ -109,13 +100,11 @@ addons:
# For certbot-nginx integration testing # For certbot-nginx integration testing
- nginx-light - nginx-light
- openssl - openssl
# For Boulder integration testing
- rsyslog
# for apacheconftest # for apacheconftest
#- apache2 - apache2
#- libapache2-mod-wsgi - libapache2-mod-wsgi
#- libapache2-mod-macro - libapache2-mod-macro
#- sudo - sudo
install: "travis_retry pip install tox coveralls" install: "travis_retry pip install tox coveralls"
script: 'travis_retry tox && ([ "xxx$BOULDER_INTEGRATION" = "xxx" ] || ./tests/travis-integration.sh)' script: 'travis_retry tox && ([ "xxx$BOULDER_INTEGRATION" = "xxx" ] || ./tests/travis-integration.sh)'
+5 -35
View File
@@ -1,40 +1,10 @@
#!/bin/bash #!/bin/bash
# Download and run Boulder instance for integration testing # Download and run Boulder instance for integration testing
# ugh, go version output is like:
# go version go1.4.2 linux/amd64
GOVER=`go version | cut -d" " -f3 | cut -do -f2`
# version comparison
function verlte {
#OS X doesn't support version sorting; emulate with sed
if [ `uname` == 'Darwin' ]; then
[ "$1" = "`echo -e \"$1\n$2\" | sed 's/\b\([0-9]\)\b/0\1/g' \
| sort | sed 's/\b0\([0-9]\)/\1/g' | head -n1`" ]
else
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
fi
}
if ! verlte 1.5 "$GOVER" ; then
echo "We require go version 1.5 or later; you have... $GOVER"
exit 1
fi
set -xe set -xe
# `/...` avoids `no buildable Go source files` errors, for more info # Check out special branch until latest docker changes land in Boulder master.
# see `go help packages` git clone -b rev-rev https://github.com/letsencrypt/boulder $BOULDERPATH
go get -d github.com/letsencrypt/boulder/... cd $BOULDERPATH
cd $GOPATH/src/github.com/letsencrypt/boulder sed -i 's/FAKE_DNS: .*/FAKE_DNS: 172.17.42.1/' docker-compose.yml
# goose is needed for ./test/create_db.sh docker-compose up -d
wget https://github.com/jsha/boulder-tools/raw/master/goose.gz && \
mkdir $GOPATH/bin && \
zcat goose.gz > $GOPATH/bin/goose && \
chmod +x $GOPATH/bin/goose
./test/create_db.sh
go run cmd/rabbitmq-setup/main.go -server amqp://localhost
# listenbuddy is needed for ./start.py
go get github.com/jsha/listenbuddy
cd -
+5 -24
View File
@@ -2,27 +2,8 @@
# >>>> only tested on Ubuntu 14.04LTS <<<< # >>>> only tested on Ubuntu 14.04LTS <<<<
# non-interactive install of mariadb and other dependencies # Check out special branch until latest docker changes land in Boulder master.
export DEBIAN_FRONTEND=noninteractive git clone -b rev-rev https://github.com/letsencrypt/boulder $BOULDERPATH
sudo debconf-set-selections <<< 'mariadb-server mysql-server/root_password password PASS' cd $BOULDERPATH
sudo debconf-set-selections <<< 'mariadb-server mysql-server/root_password_again password PASS' sed -i 's/FAKE_DNS: .*/FAKE_DNS: 172.17.42.1/' docker-compose.yml
apt-get -y --no-upgrade install git make libltdl3-dev mariadb-server rabbitmq-server docker-compose up -d
sudo mysql -uroot -pPASS -e "SET PASSWORD = PASSWORD(\'\');"
# install go
wget https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz
tar xzvf go1.5.1.linux-amd64.tar.gz
mkdir gocode
echo "export GOROOT=/home/ubuntu/go \n\
export GOPATH=/home/ubuntu/gocode\n\
export PATH=/home/ubuntu/go/bin:/home/ubuntu/gocode/bin:$PATH" >> .bashrc
# install boulder and its go dependencies
go get -d github.com/letsencrypt/boulder/...
cd $GOPATH/src/github.com/letsencrypt/boulder
wget https://github.com/jsha/boulder-tools/raw/master/goose.gz
mkdir $GOPATH/bin
zcat goose.gz > $GOPATH/bin/goose
chmod +x $GOPATH/bin/goose
./test/create_db.sh
go get github.com/jsha/listenbuddy
+5 -10
View File
@@ -6,14 +6,9 @@ set -o errexit
source .tox/$TOXENV/bin/activate source .tox/$TOXENV/bin/activate
export CERTBOT_PATH=`pwd` until curl http://boulder:4000/directory 2>/dev/null; do
echo waiting for boulder
sleep 1
done
cd $GOPATH/src/github.com/letsencrypt/boulder/ ./tests/boulder-integration.sh
# boulder's integration-test.py has code that knows to start and wait for the
# boulder processes to start reliably and then will run the certbot
# boulder-interation.sh on its own. The --certbot flag says to run only the
# certbot tests (instead of any other client tests it might run). We're
# going to want to define a more robust interaction point between the boulder
# and certbot tests, but that will be better built off of this.
python test/integration-test.py --certbot