Travis and Coveralls integration

Add travis configuration and dependencies script
Split integration test make targets to allow parallel execution in Travis
Add go packages required for coverage upload to Coveralls
Add coveralls and travis badges to README

Travis: Retry make targets to address flaky targets
This commit is contained in:
Anand Henry 2014-09-30 18:59:51 -07:00
Родитель 2163ac1673
Коммит cdfa764d7f
7 изменённых файлов: 119 добавлений и 28 удалений

25
.travis.yml Normal file
Просмотреть файл

@ -0,0 +1,25 @@
language: go
env:
global:
- MYSQL_FLAVOR=MariaDB
matrix:
- MAKE_TARGET=unit_test
- MAKE_TARGET=queryservice_test
- MAKE_TARGET=small_integration_test
- MAKE_TARGET=medium_integration_test
- MAKE_TARGET=large_integration_test
- MAKE_TARGET=huge_integration_test
- MAKE_TARGET=java_vtgate_client_test
- MAKE_TARGET=unit_test_goveralls
before_install:
- bash -v travis/dependencies.sh
install:
- bash -v bootstrap.sh
script:
- source dev.env
- travis_retry make $MAKE_TARGET
branches:
only:
- travis-ci
notifications:
email: false

Просмотреть файл

@ -40,6 +40,11 @@ unit_test_cover:
unit_test_race:
go test -race ./go/...
unit_test_goveralls:
go list -f '{{if len .TestGoFiles}}go test -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}{{end}}' ./go/... | xargs -i sh -c {}
gover ./go/
goveralls -coverprofile=gover.coverprofile -repotoken $$COVERALLS_TOKEN
queryservice_test:
echo $$(date): Running test/queryservice_test.py...
if [ -e "/usr/bin/memcached" ]; then \
@ -63,34 +68,47 @@ site_integration_test_files = \
zkocc_test.py
# These tests should be run by developers after making code changes.
integration_test_files = \
binlog.py \
clone.py \
initial_sharding_bytes.py \
initial_sharding.py \
# integration tests that take under 45s to run
small_integration_test_files = \
keyrange_test.py \
keyspace_test.py \
mysqlctl.py \
reparent.py \
resharding_bytes.py \
resharding.py \
rowcache_invalidator.py \
secure.py \
schema.py \
sharded.py \
tabletmanager.py \
keyspace_test.py \
update_stream.py \
schema.py \
vertical_split.py \
secure.py \
vertical_split_vtgate.py \
binlog.py \
clone.py
# integration tests that take between 45s and 1 min
medium_integration_test_files = \
tabletmanager.py \
reparent.py \
vtdb_test.py \
rowcache_invalidator.py \
initial_sharding.py
# integration tests that take between 1-2 mins
large_integration_test_files = \
vtgatev2_test.py \
zkocc_test.py
resharding_bytes.py \
zkocc_test.py \
initial_sharding_bytes.py
# integration tests that take more than 2 mins
huge_integration_test_files = \
resharding.py
.ONESHELL:
SHELL = /bin/bash
integration_test:
# function to execute a list of integration test files
# exits on first failure
define run_integration_tests
cd test ; \
for t in $(integration_test_files) ; do \
for t in $1 ; do \
echo $$(date): Running test/$$t... ; \
output=$$(time ./$$t $$VT_TEST_FLAGS 2>&1) ; \
if [[ $$? != 0 ]]; then \
@ -99,23 +117,33 @@ integration_test:
fi ; \
echo ; \
done
endef
small_integration_test:
$(call run_integration_tests, $(small_integration_test_files))
medium_integration_test:
$(call run_integration_tests, $(medium_integration_test_files))
large_integration_test:
$(call run_integration_tests, $(large_integration_test_files))
huge_integration_test:
$(call run_integration_tests, $(huge_integration_test_files))
integration_test: small_integration_test medium_integration_test large_integration_test huge_integration_test
site_integration_test:
cd test ; \
for t in $(site_integration_test_files) ; do \
echo $$(date): Running test/$$t... ; \
output=$$(time ./$$t $$VT_TEST_FLAGS 2>&1) ; \
if [[ $$? != 0 ]]; then \
echo "$$output" >&2 ; \
exit 1 ; \
fi ; \
echo ; \
done
$(call run_integration_tests, $(site_integration_test_files))
# this rule only works if bootstrap.sh was successfully ran in ./java
java_test:
cd java && mvn verify
java_vtgate_client_test:
mvn -f java/gorpc/pom.xml clean install -DskipTests
mvn -f java/vtgate-client/pom.xml clean verify
v3_test:
cd test && ./vtgatev3_test.py

Просмотреть файл

@ -1,5 +1,7 @@
# Vitess
[![Build Status](https://travis-ci.org/youtube/vitess.svg?branch=travis-ci)](https://travis-ci.org/youtube/vitess) [![Coverage Status](https://img.shields.io/coveralls/youtube/vitess.svg)](https://coveralls.io/r/youtube/vitess?branch=travis-ci)
Vitess is a set of servers and tools meant to facilitate scaling of MySQL
databases for the web. It's been developed since 2011, and is currently used as
a fundamental component of YouTube's MySQL infrastructure, serving thousands of

Просмотреть файл

@ -42,6 +42,11 @@ go get code.google.com/p/go.net/context
go get code.google.com/p/go.tools/cmd/goimports
go get github.com/golang/glog
# Packages for uploading code coverage to coveralls.io
go get code.google.com/p/go.tools/cmd/cover
go get github.com/modocache/gover
go get github.com/mattn/goveralls
ln -snf $VTTOP/config $VTROOT/config
ln -snf $VTTOP/data $VTROOT/data
ln -snf $VTTOP/py $VTROOT/py-vtdb

Просмотреть файл

@ -27,7 +27,7 @@ class ZkTopoServer(server.TopoServer):
self.zk_port_base = reserve_ports(3)
self.zkocc_port_base = reserve_ports(3)
self.hostname = socket.gethostname()
self.hostname = socket.getfqdn()
self.zk_ports = ':'.join(str(self.zk_port_base + i) for i in range(3))
self.zk_client_port = self.zk_port_base + 2
self.ports_assigned = True

Просмотреть файл

@ -25,7 +25,7 @@ from topo_flavor.server import set_topo_server_flavor
options = None
devnull = open('/dev/null', 'w')
hostname = socket.gethostname()
hostname = socket.getfqdn()
class TestError(Exception):
pass

31
travis/dependencies.sh Normal file
Просмотреть файл

@ -0,0 +1,31 @@
#!/bin/bash
set -e
# Add MariaDB repository
sudo apt-get install python-software-properties
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.utexas.edu/mariadb/repo/10.0/ubuntu precise main'
sudo apt-get update
# Remove pre-installed mysql
sudo apt-get purge mysql* mariadb*
# MariaDB
sudo apt-get -f install \
libmysqlclient18=10.0.15+maria-1~precise \
libmariadbclient18=10.0.15+maria-1~precise \
libmariadbclient-dev=10.0.15+maria-1~precise \
mariadb-client-10.0=10.0.15+maria-1~precise \
mariadb-client-core-10.0=10.0.15+maria-1~precise \
mariadb-server-10.0=10.0.15+maria-1~precise \
mariadb-server-core-10.0=10.0.15+maria-1~precise
# Other dependencies
sudo apt-get install time automake libtool memcached python-dev python-mysqldb libssl-dev g++ mercurial git pkg-config bison bc
# Java dependencies
wget https://dl.bintray.com/sbt/debian/sbt-0.13.6.deb
sudo dpkg -i sbt-0.13.6.deb
sudo apt-get install protobuf-compiler maven
set +e