Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

Commit

Permalink
remove all integration tests from travisci, add semaphoreci badge to …
Browse files Browse the repository at this point in the history
…README (#397)
  • Loading branch information
jipperinbham authored Aug 14, 2017
1 parent 9fa8ec7 commit dac78e0
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 119 deletions.
8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,17 @@ env:
- TESTDIR=adaptor/postgres/...
- TESTDIR=adaptor/rabbitmq/...
- TESTDIR=adaptor/rethinkdb/...
- TESTDIR=integration_tests/mongo_to_mongo
- TESTDIR=integration_tests/mongo_to_es
- TESTDIR=integration_tests/mongo_to_rethink
- TESTDIR=integration_tests/rethink_to_postgres
before_install:
- "./scripts/before_install.sh"
cache:
directories:
- "$HOME/.cache/pip"
before_cache:
- if [[ $TESTDIR != integration* ]]; then rm -f $HOME/.cache/pip/log/debug.log; fi
- rm -f $HOME/.cache/pip/log/debug.log
script:
- "./scripts/tests.sh"
after_success:
- if [[ $TESTDIR != integration* ]]; then bash <(curl -s https://codecov.io/bash); fi
- bash <(curl -s https://codecov.io/bash)
addons:
postgresql: '9.4'
rethinkdb: '2.3.5'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/compose/transporter.svg?branch=master)](https://travis-ci.org/compose/transporter) [![Go Report Card](https://goreportcard.com/badge/github.com/compose/transporter)](https://goreportcard.com/report/github.com/compose/transporter) [![codecov](https://codecov.io/gh/compose/transporter/branch/master/graph/badge.svg)](https://codecov.io/gh/compose/transporter) [![Docker Repository on Quay](https://quay.io/repository/compose/transporter/status "Docker Repository on Quay")](https://quay.io/repository/compose/transporter) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/compose-transporter/Lobby)
[![Build Status](https://travis-ci.org/compose/transporter.svg?branch=master)](https://travis-ci.org/compose/transporter) [![Build Status](https://semaphoreci.com/api/v1/compose/transporter/branches/master/shields_badge.svg)](https://semaphoreci.com/compose/transporter) [![Go Report Card](https://goreportcard.com/badge/github.com/compose/transporter)](https://goreportcard.com/report/github.com/compose/transporter) [![codecov](https://codecov.io/gh/compose/transporter/branch/master/graph/badge.svg)](https://codecov.io/gh/compose/transporter) [![Docker Repository on Quay](https://quay.io/repository/compose/transporter/status "Docker Repository on Quay")](https://quay.io/repository/compose/transporter) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/compose-transporter/Lobby)

Compose Transporter helps with database transformations from one store to another. It can also sync from one to another or several stores.

Expand Down
12 changes: 5 additions & 7 deletions scripts/after_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

set -ev

if [[ $TRAVIS_EVENT_TYPE != 'cron' ]]; then
if [[ $TESTDIR == pkg/adaptor/mongodb* ]]; then
mongo-orchestration stop
elif [[ $TESTDIR == pkg/adaptor/rabbitmq* ]]; then
haproxy_pid=$(ps -ef | grep "[h]aproxy" | awk '{print $2}')
kill $haproxy_pid
fi
if [[ $TESTDIR == pkg/adaptor/mongodb* ]]; then
mongo-orchestration stop
elif [[ $TESTDIR == pkg/adaptor/rabbitmq* ]]; then
haproxy_pid=$(ps -ef | grep "[h]aproxy" | awk '{print $2}')
kill $haproxy_pid
fi
18 changes: 8 additions & 10 deletions scripts/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

set -ev

if [[ $TRAVIS_EVENT_TYPE != 'cron' ]]; then
if [[ $TESTDIR == adaptor/mongodb* ]]; then
pip install "mongo-orchestration>=0.6.7,<1.0"
if [[ $TESTDIR == adaptor/mongodb* ]]; then
pip install "mongo-orchestration>=0.6.7,<1.0"

wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION.tgz
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION.tgz

mkdir -p /tmp/mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION
mkdir -p /tmp/mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION

tar xfz mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION.tgz -C /tmp
tar xfz mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION.tgz -C /tmp

rm mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION.tgz
rm mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION.tgz

export PATH=/tmp/mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION/bin:$PATH
export PATH=/tmp/mongodb-linux-x86_64-ubuntu1404-$MONGODB_VERSION/bin:$PATH

mongod --version
fi
mongod --version
fi
132 changes: 65 additions & 67 deletions scripts/before_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,79 @@

set -e

if [[ $TRAVIS_EVENT_TYPE != 'cron' ]]; then
case "$TESTDIR" in
'adaptor/postgres/...')
echo "Configuring postgresql"
psql -c "ALTER SYSTEM SET max_replication_slots = 4"
psql -c "ALTER SYSTEM SET wal_level = logical"
sudo /etc/init.d/postgresql restart; sleep 1
;;
'adaptor/elasticsearch/...')
echo "Configuring elasticsearch"
mkdir -p /tmp/elasticsearch/config
cp -r config/elasticsearch/* /tmp/elasticsearch/config/
sudo sysctl -w vm.max_map_count=262144
docker run --rm --privileged=true -p 127.0.0.1:9205:9205 -v "/tmp/elasticsearch/config/v5:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:5.1.2 elasticsearch >& /dev/null &
docker run --rm --privileged=true -p 127.0.0.1:9202:9202 -v "/tmp/elasticsearch/config/v2:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:2.4.4 elasticsearch >& /dev/null &
docker run --rm --privileged=true -p 127.0.0.1:9201:9201 -v "/tmp/elasticsearch/config/v1:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:1.7.6 elasticsearch >& /dev/null &
sleep 15
;;
'adaptor/rabbitmq/...')
echo "Configuring rabbitmq"
mkdir -p /tmp/rabbitmq
cp -r config/rabbitmq/certs/* /tmp/rabbitmq/
case "$TESTDIR" in
'adaptor/postgres/...')
echo "Configuring postgresql"
psql -c "ALTER SYSTEM SET max_replication_slots = 4"
psql -c "ALTER SYSTEM SET wal_level = logical"
sudo /etc/init.d/postgresql restart; sleep 1
;;
'adaptor/elasticsearch/...')
echo "Configuring elasticsearch"
mkdir -p /tmp/elasticsearch/config
cp -r config/elasticsearch/* /tmp/elasticsearch/config/
sudo sysctl -w vm.max_map_count=262144
docker run --rm --privileged=true -p 127.0.0.1:9205:9205 -v "/tmp/elasticsearch/config/v5:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:5.1.2 elasticsearch >& /dev/null &
docker run --rm --privileged=true -p 127.0.0.1:9202:9202 -v "/tmp/elasticsearch/config/v2:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:2.4.4 elasticsearch >& /dev/null &
docker run --rm --privileged=true -p 127.0.0.1:9201:9201 -v "/tmp/elasticsearch/config/v1:/usr/share/elasticsearch/config" -e ES_JAVA_OPTS='-Xms1g -Xmx1g' elasticsearch:1.7.6 elasticsearch >& /dev/null &
sleep 15
;;
'adaptor/rabbitmq/...')
echo "Configuring rabbitmq"
mkdir -p /tmp/rabbitmq
cp -r config/rabbitmq/certs/* /tmp/rabbitmq/

mkdir -p /tmp/rabbitmq_bad_cert
cp -r config/rethinkdb/certs/* /tmp/rabbitmq_bad_cert/
mkdir -p /tmp/rabbitmq_bad_cert
cp -r config/rethinkdb/certs/* /tmp/rabbitmq_bad_cert/

sudo apt-get update -qq
sudo apt-get install -y python-software-properties ssh
# Install haproxy-1.5
sudo add-apt-repository -y ppa:vbernat/haproxy-1.5
sudo apt-get update -qq
sudo apt-get install haproxy
sudo service rabbitmq-server start
sleep 10
sudo haproxy -f config/rabbitmq/haproxy.cfg -db &
;;
'adaptor/rethinkdb/...')
echo "Configuring rethinkdb"
mkdir -p /tmp/rethinkdb
cp -r config/rethinkdb/certs/* /tmp/rethinkdb/
sudo apt-get update -qq
sudo apt-get install -y python-software-properties ssh
# Install haproxy-1.5
sudo add-apt-repository -y ppa:vbernat/haproxy-1.5
sudo apt-get update -qq
sudo apt-get install haproxy
sudo service rabbitmq-server start
sleep 10
sudo haproxy -f config/rabbitmq/haproxy.cfg -db &
;;
'adaptor/rethinkdb/...')
echo "Configuring rethinkdb"
mkdir -p /tmp/rethinkdb
cp -r config/rethinkdb/certs/* /tmp/rethinkdb/

mkdir -p /tmp/rethinkdb_ssl
rethinkdb --config-file config/rethinkdb/configurations/ssl.conf >& /dev/null &
mkdir -p /tmp/rethinkdb_ssl
rethinkdb --config-file config/rethinkdb/configurations/ssl.conf >& /dev/null &

mkdir -p /tmp/rethinkdb_auth
rethinkdb --initial-password admin123 --config-file config/rethinkdb/configurations/auth.conf >& /dev/null &
;;
'adaptor/mongodb/...')
echo "Configuring mongodb"
mkdir -p /tmp/mongodb
cp -r config/mongodb/certs/* /tmp/mongodb/
mongo-orchestration start -p 20000 -b 127.0.0.1
mkdir -p /tmp/rethinkdb_auth
rethinkdb --initial-password admin123 --config-file config/rethinkdb/configurations/auth.conf >& /dev/null &
;;
'adaptor/mongodb/...')
echo "Configuring mongodb"
mkdir -p /tmp/mongodb
cp -r config/mongodb/certs/* /tmp/mongodb/
mongo-orchestration start -p 20000 -b 127.0.0.1

# setup mongodb configurations
# setup mongodb configurations

# standard replica set w/ authentication enabled
cat config/mongodb/configurations/rs_auth.json | curl -XPOST http://localhost:20000/v1/replica_sets -H "Content-Type: application/json" -d @-
# standard replica set w/ authentication enabled
cat config/mongodb/configurations/rs_auth.json | curl -XPOST http://localhost:20000/v1/replica_sets -H "Content-Type: application/json" -d @-

# basic server
cat config/mongodb/configurations/basic.json | curl -XPOST http://localhost:20000/v1/servers -H "Content-Type: application/json" -d @-
# basic server
cat config/mongodb/configurations/basic.json | curl -XPOST http://localhost:20000/v1/servers -H "Content-Type: application/json" -d @-

# basic server used for restart tests
cat config/mongodb/configurations/reader_restart.json | curl -XPOST http://localhost:20000/v1/servers -H "Content-Type: application/json" -d @-
# basic server used for restart tests
cat config/mongodb/configurations/reader_restart.json | curl -XPOST http://localhost:20000/v1/servers -H "Content-Type: application/json" -d @-

# SSL server
cat config/mongodb/configurations/ssl.json | curl -XPOST http://localhost:20000/v1/servers -H "Content-Type: application/json" -d @-
# SSL server
cat config/mongodb/configurations/ssl.json | curl -XPOST http://localhost:20000/v1/servers -H "Content-Type: application/json" -d @-

# standard replica set
cat config/mongodb/configurations/rs_basic.json | curl -XPOST http://localhost:20000/v1/replica_sets -H "Content-Type: application/json" -d @-
# standard replica set
cat config/mongodb/configurations/rs_basic.json | curl -XPOST http://localhost:20000/v1/replica_sets -H "Content-Type: application/json" -d @-

# seed database with users and role
mongo mongodb://transporter:[email protected]:10000,127.0.0.1:10001/admin?replicaSet=authRepl0 config/mongodb/scripts/setup_users_and_roles.js
;;
*)
echo "no setup required for $TESTDIR"
;;
esac
fi
# seed database with users and role
mongo mongodb://transporter:[email protected]:10000,127.0.0.1:10001/admin?replicaSet=authRepl0 config/mongodb/scripts/setup_users_and_roles.js
;;
*)
echo "no setup required for $TESTDIR"
;;
esac
42 changes: 14 additions & 28 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,18 @@

set -e

if [[ "$TRAVIS_EVENT_TYPE" == "cron" && "$TESTDIR" == integration_tests* ]]; then
echo "running integration tests in $TESTDIR"

go install ./cmd/transporter/...

go test -v ./$TESTDIR/... -cleanup=true -tags=integration

transporter run $TESTDIR/app.js

go test -v ./$TESTDIR/... -tags=integration -log.level=error
elif [[ "$TRAVIS_EVENT_TYPE" != "cron" && "$TESTDIR" != integration_tests* ]]; then
echo "running tests in $TESTDIR"

echo "" > coverage.txt

IFS=', ' read -r -a test_dir <<< "$TESTDIR"
for t in "${test_dir[@]}"; do
echo "testing $t"
for d in $(go list ./$t); do
go test -v -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
echo "running tests in $TESTDIR"

echo "" > coverage.txt

IFS=', ' read -r -a test_dir <<< "$TESTDIR"
for t in "${test_dir[@]}"; do
echo "testing $t"
for d in $(go list ./$t); do
go test -v -coverprofile=profile.out -covermode=atomic $d -log.level=error
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
else
echo "skipping $TESTDIR"
fi
done

0 comments on commit dac78e0

Please sign in to comment.