language: node_js
sudo: required
node_js:
    - 4.5
    - 6.5
    - 7.0

env:
    - NEO4J_AUTH="none"

services:
    - mysql
    - postgresql
    - redis-server
    - mongodb

before_script:
    - sudo apt-get update -o Acquire::http::No-Cache=True
    - sudo apt-get install -y apt-transport-https libgoogle-perftools4
    # configure mysql
    - mysql -e "CREATE USER 'test'@'%' IDENTIFIED BY 'test';" -uroot
    - mysql -e "CREATE DATABASE IF NOT EXISTS test;" -uroot
    - mysql -e "GRANT ALL PRIVILEGES ON test . * TO 'test'@'%';" -uroot
    - mysql -e "FLUSH PRIVILEGES;" -uroot
    - sleep 2
    # configure postgres
    - psql -c "CREATE ROLE test LOGIN ENCRYPTED PASSWORD 'test' NOINHERIT VALID UNTIL 'infinity';" -U postgres
    - psql -c "CREATE DATABASE test WITH ENCODING='UTF8' OWNER=test;" -U postgres
    - sleep 2
    # configure mongodb
    - mongo test --eval 'db.createUser({user:"test", pwd:"test", roles:["readWrite"]});'
    # add and configure rethinkdb
    - curl http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
    - echo "deb http://download.rethinkdb.com/apt $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/rethinkdb.list
    - sudo apt-get update -q
    - sudo apt-get install rethinkdb -y
    - sudo cp /etc/rethinkdb/default.conf.sample /etc/rethinkdb/instances.d/default.conf
    - sudo service rethinkdb restart
    # add arangodb
    - curl -O https://download.arangodb.com/arangodb2/xUbuntu_$(lsb_release -rs)/amd64/arangodb_2.8.11_amd64.deb
    - sudo dpkg -i arangodb_2.8.11_amd64.deb
    # start neo4j
    - sudo $(which neo4j) start
    - netstat -antp | grep LISTEN
