diff --git a/.gitignore b/.gitignore index 16e5fb1..4754989 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ *.retry -**/dependencies/* +**/roles/* # Created by https://www.gitignore.io diff --git a/.travis.yml b/.travis.yml index c6d0f94..1621bf2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,12 +3,22 @@ sudo: yes matrix: include: + - python: 3.6 + env: TOXENV=py36-ansible27 + - python: 3.6 + env: TOXENV=py36-ansible26 + - python: 3.6 + env: TOXENV=py36-ansible25 + - python: 2.7 + env: TOXENV=py27-ansible24 + - python: 2.7 + env: TOXENV=py27-ansible23 + - python: 2.7 + env: TOXENV=py27-ansible22 - python: 2.7 env: TOXENV=py27-ansible21 - python: 2.7 env: TOXENV=py27-ansible20 - - python: 2.7 - env: TOXENV=py27-ansible19 install: - pip install tox @@ -17,12 +27,23 @@ script: - tox notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ + email: false + slack: + template: + - "%{repository_name}@%{branch} %{commit} : [%{build_number}] %{result} " + - "%{build_url}" + - "'%{commit_subject}' by %{author}" + - "%{elapsed_time} : %{duration}" + - "%{message}" + rooms: + secure:xxx + on_success: always + on_failure: always + webhooks: https://galaxy.ansible.com/api/v1/notifications/ before_cache: - - rm -f ${HOME}/.cache/pip/log/debug.log + - "find ${HOME}/.pip -name log -o -name __pycache__ -type d | xargs -I {} rm -rf {}" cache: directories: - - ${HOME}/.cache/pip - + - "${HOME}/.cache/pip" diff --git a/tests/Vagrantfile b/tests/Vagrantfile index b4e1f42..3969e98 100644 --- a/tests/Vagrantfile +++ b/tests/Vagrantfile @@ -4,6 +4,7 @@ require 'yaml' PLAYBOOK = 'test.yml' CONFIGURATION_FILE = 'boxes.yml' +ROLE_NAME = "#{File.expand_path("..").split("/")[-1]}" Vagrant.configure('2') do |config| @@ -24,15 +25,16 @@ Vagrant.configure('2') do |config| config.vm.define box_name do |host| host.vm.box = box_settings['box'] unless not box_settings.key? 'box' + host.vm.box_version = box_settings['box_version'] unless not box_settings.key? 'box_version' host.vm.network box_settings['network']['name'], ip: box_settings['network']['ip'] unless box_settings.key? 'network' - host.vm.network :forwarded_port, guest: 3000, host: 3000 host.vm.synced_folder '.', '/vagrant', disabled: true # puts "[DEBUG] applying virtualbox settings for #{box_name} box..." customize_args = [ "modifyvm", :id ] - box_settings['provider']['virtualbox'].collect { |k, v| customize_args |= ["--#{k}", v.to_s] } + vagrant_environment['provider']['virtualbox'].collect { |k, v| customize_args |= ["--#{k}", v.to_s] } host.vm.provider 'virtualbox' do |vb| + vb.name = "#{ROLE_NAME}_#{box_name}" vb.customize customize_args end @@ -47,7 +49,19 @@ Vagrant.configure('2') do |config| 'yakkety64.vagrant.dev' => { 'ansible_python_interpreter' => '/usr/bin/python2.7', 'playbook_python2' => true - } + }, + 'artful64.vagrant.dev' => { + 'ansible_python_interpreter' => '/usr/bin/python2.7', + 'playbook_python2' => true + }, + 'bionic64.vagrant.dev' => { + 'ansible_python_interpreter' => '/usr/bin/python2.7', + 'playbook_python2' => true + }, + 'cosmic64.vagrant.dev' => { + 'ansible_python_interpreter' => '/usr/bin/python2.7', + 'playbook_python2' => true + }, } ansible.playbook = PLAYBOOK diff --git a/tests/ansible.cfg b/tests/ansible.cfg index 992355f..e487797 100644 --- a/tests/ansible.cfg +++ b/tests/ansible.cfg @@ -6,5 +6,4 @@ host_key_checking = False private_key_file = ~/.vagrant.d/insecure_private_key -roles_path = ../../:../:dependencies - +roles_path = ../../:../ diff --git a/tests/boxes.yml b/tests/boxes.yml index efeef9f..a627456 100644 --- a/tests/boxes.yml +++ b/tests/boxes.yml @@ -2,6 +2,11 @@ # file: influxdb/tests/boxes.yml # +provider: + virtualbox: + memory: 1024 + cpus: 1 + vagrant: # Debian @@ -13,11 +18,6 @@ vagrant: name: private_network ip: 192.168.122.1 - provider: - virtualbox: - memory: 1024 - cpus: 1 - wheezy64.vagrant.dev: enabled: true box: debian/wheezy64 @@ -25,36 +25,63 @@ vagrant: name: private_network ip: 192.168.122.2 - provider: - virtualbox: - memory: 1024 - cpus: 1 + stretch64.vagrant.dev: + enabled: false + box: debian/stretch64 + network: + name: private_network + ip: 192.168.122.3 # Ubuntu + precise32.vagrant.dev: + enabled: false + box: ubuntu/precise32 + network: + name: private_network + ip: 192.168.124.1 + precise64.vagrant.dev: - enabled: true + enabled: false box: ubuntu/precise64 network: name: private_network ip: 192.168.124.2 - provider: - virtualbox: - memory: 1024 - cpus: 1 + trusty32.vagrant.dev: + enabled: false + box: ubuntu/trusty32 + network: + name: private_network + ip: 192.168.124.3 trusty64.vagrant.dev: - enabled: true + enabled: false box: ubuntu/trusty64 network: name: private_network ip: 192.168.124.4 - provider: - virtualbox: - memory: 1024 - cpus: 1 + vivid32.vagrant.dev: + enabled: false + box: ubuntu/vivid32 + network: + name: private_network + ip: 192.168.124.5 + + vivid64.vagrant.dev: + enabled: false + box: ubuntu/vivid64 + network: + name: private_network + ip: 192.168.124.6 + + wily64.vagrant.dev: + enabled: true + box: ubuntu/wily64 + network: + name: private_network + ip: 192.168.124.7 xenial64.vagrant.dev: enabled: true @@ -63,19 +90,30 @@ vagrant: name: private_network ip: 192.168.124.8 - provider: - virtualbox: - memory: 1024 - cpus: 1 - yakkety64.vagrant.dev: - enabled: false + enabled: true box: ubuntu/yakkety64 network: name: private_network ip: 192.168.124.9 - provider: - virtualbox: - memory: 1024 - cpus: 1 + artful64.vagrant.dev: + enabled: true + box: ubuntu/artful64 + network: + name: private_network + ip: 192.168.124.10 + + bionic64.vagrant.dev: + enabled: true + box: ubuntu/bionic64 + network: + name: private_network + ip: 192.168.124.11 + + cosmic64.vagrant.dev: + enabled: true + box: ubuntu/cosmic64 + network: + name: private_network + ip: 192.168.124.12 diff --git a/tests/dependencies/.gitkeep b/tests/roles/.gitkeep similarity index 100% rename from tests/dependencies/.gitkeep rename to tests/roles/.gitkeep diff --git a/tests/setup.sh b/tests/setup.sh index 47fa6eb..044fb87 100644 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -29,5 +29,5 @@ test -s ${DIR}/../requirements.yml \ && ansible-galaxy install \ --force \ -r ${DIR}/../requirements.yml \ - --roles-path=${DIR}/dependencies \ + --roles-path=${DIR}/roles \ || true diff --git a/tests/test.yml b/tests/test.yml index e39ef49..cc7e068 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -7,6 +7,7 @@ tasks: - raw: sudo apt-get update -qq && sudo apt-get install -qq python2.7 + changed_when: no when: playbook_python2 is defined and playbook_python2 diff --git a/tests/vagrant.sh b/tests/vagrant.sh index 9e4bed3..542b581 100644 --- a/tests/vagrant.sh +++ b/tests/vagrant.sh @@ -3,7 +3,7 @@ # # Bash script to run the test suite against the Vagrant environment. # -# version: 1.2 +# version: 1.8 # # usage: # @@ -16,6 +16,9 @@ # # changelog: # +# v1.8 : 10 August 2016 +# - force provisioning +# # v1.6 : 10 Jun 2016 # - exit if USER environment variable is travis # @@ -61,7 +64,7 @@ do if [ ! -n "${BOX+1}" ] || [ "${BOX}" = "${VAGRANT_BOX}" ]; then echo "[INFO] preparing ${VAGRANT_BOX}..." - vagrant up ${VAGRANT_BOX} 2> /dev/null + vagrant up --provision ${VAGRANT_BOX} 2> /dev/null if [ $? -ne 0 ]; then # box not enabled continue @@ -74,4 +77,3 @@ do vagrant destroy -f ${VAGRANT_BOX} fi done - diff --git a/tox.ini b/tox.ini index b8c58df..106b63d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - {py27}-{ansible21,ansible20,ansible19} + py{36,27}-ansible{27,26,25,24,23,22,21,20,19} skipsdist = True @@ -9,9 +9,16 @@ skipsdist = True changedir = tests deps = - ansible21: ansible==2.1.* - ansible20: ansible==2.0.* - ansible19: ansible==1.9.* + ansible27: ansible>=2.7,<2.8 + ansible26: ansible>=2.6,<2.7 + ansible25: ansible>=2.5,<2.6 + ansible24: ansible>=2.4,<2.5 + ansible23: ansible>=2.3,<2.4 + ansible22: ansible>=2.2,<2.3 + ansible21: ansible>=2.1,<2.2 + ansible20: ansible>=2.0.0,<2.1 + ansible19: ansible>=1.9,<2.0.0 + passenv = ANSIBLE_ASK_SUDO_PASS HOME LANG LC_ALL TRAVIS USER