-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
41 lines (41 loc) · 1.79 KB
/
.travis.yml
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
32
33
34
35
36
37
38
39
40
41
language: python
sudo: true
cache: pip
env:
- TOX_ENV=py27-pymongo
- TOX_ENV=py34-pymongo
- TOX_ENV=py35-pymongo
- TOX_ENV=pypy-pymongo
- TOX_ENV=pep8
before_install:
- "sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927"
- "echo 'deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.2 multiverse' | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list"
- "sudo apt-get update"
- "sudo apt-get install mongodb-org"
- "echo 'replication:' | sudo tee -a /etc/mongod.conf"
- "echo ' replSetName: ReplicaSet' | sudo tee -a /etc/mongod.conf"
- "sudo service mongod restart"
- "mkdir /tmp/mongodb"
- "mkdir /tmp/mongodb2"
- "mongod --dbpath /tmp/mongodb --port 27018 &"
- "mongod --dbpath /tmp/mongodb2 --port 27019 --replSet ReplicaSet &"
- "mongos --configdb localhost:27017 --port 27020 &"
install:
- pip install tox
- pip install coveralls
before_script:
- "until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done"
- "hostname | sed 's/^/127.0.0.1 /' | sudo tee -a /etc/hosts"
- "mongo --eval 'rs.initiate()'"
- mongo --eval "rs.add('localhost:27019')"
- "until [ `mongo --eval 'rs.isMaster()' | grep ismaster | awk '{print $3}'` = 'true,' ] ; do echo 'Waiting for Primary'; sleep 1; done"
- "until [ `mongo --port 27018 --eval 'rs.isMaster()' | grep ismaster | awk '{print $3}'` = 'true,' ] ; do echo 'Waiting for non replica'; sleep 1; done"
- "until [ `mongo --port 27020 --eval 'rs.isMaster()' | grep ismaster | awk '{print $3}'` = 'true,' ] ; do echo 'Waiting for mongos'; sleep 1; done"
script:
- tox -e $TOX_ENV
after_success:
- coveralls
after_script:
- mongo --port 27018 admin --eval "db.shutdownServer()"
- mongo --port 27019 admin --eval "db.shutdownServer()"
- mongo --port 27020 admin --eval "db.shutdownServer()"