Added Kitchen tests and Travis
diff --git a/.kitchen.yml b/.kitchen.yml
new file mode 100644
index 0000000..9300102
--- /dev/null
+++ b/.kitchen.yml
@@ -0,0 +1,48 @@
+---
+driver:
+ name: docker
+ hostname: aodh.ci.local
+ use_sudo: false
+
+provisioner:
+ name: salt_solo
+ salt_install: bootstrap
+ salt_bootstrap_url: https://bootstrap.saltstack.com
+ salt_version: latest
+ require_chef: false
+ log_level: error
+ formula: aodh
+ grains:
+ noservices: True
+ state_top:
+ base:
+ "*":
+ - aodh
+ pillars:
+ top.sls:
+ base:
+ "*":
+ - aodh
+
+verifier:
+ name: inspec
+ sudo: true
+
+platforms:
+ - name: <%=ENV['PLATFORM'] || 'ubuntu-xenial'%>
+ driver_config:
+ image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
+ platform: ubuntu
+
+suites:
+
+ - name: server_cluster
+ provisioner:
+ pillars-from-files:
+ aodh.sls: tests/pillar/server_cluster.sls
+
+ - name: server_single
+ provisioner:
+ pillars-from-files:
+ aodh.sls: tests/pillar/server_single.sls
+# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..5789971
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,41 @@
+sudo: required
+services:
+ - docker
+
+install:
+ - pip install PyYAML
+ - pip install virtualenv
+ - |
+ test -e Gemfile || cat <<EOF > Gemfile
+ source 'https://rubygems.org'
+ gem 'rake'
+ gem 'test-kitchen'
+ gem 'kitchen-docker'
+ gem 'kitchen-inspec'
+ gem 'inspec'
+ gem 'kitchen-salt', :git => 'https://github.com/salt-formulas/kitchen-salt.git'
+ - bundle install
+
+env:
+ # - PLATFORM=trevorj/salty-whales:trusty
+ ## Missing Trusty packages for aodh
+ - PLATFORM=trevorj/salty-whales:xenial
+
+
+before_script:
+ - set -o pipefail
+ - make test | tail
+
+script:
+ - test ! -e .kitchen.yml || bundle exec kitchen test -t tests/integration
+
+notifications:
+ webhooks:
+ urls:
+ - https://webhooks.gitter.im/e/6123573504759330786b
+ on_success: change # options: [always|never|change] default: always
+ on_failure: never # options: [always|never|change] default: always
+ on_start: never # options: [always|never|change] default: always
+ on_cancel: never # options: [always|never|change] default: always
+ on_error: never # options: [always|never|change] default: always
+ email: false
diff --git a/aodh/server.sls b/aodh/server.sls
index 58c97a9..52f4ac2 100644
--- a/aodh/server.sls
+++ b/aodh/server.sls
@@ -14,6 +14,8 @@
- require:
- pkg: server_packages
+{%- if not grains.get('noservices', False) %}
+
aodh_syncdb:
cmd.run:
- name: aodh-dbsync
@@ -21,6 +23,8 @@
- file: /etc/aodh/aodh.conf
- pkg: server_packages
+{%- endif %}
+
aodh_server_services:
service.running:
- names: {{ server.services }}
diff --git a/tests/pillar/server_cluster.sls b/tests/pillar/server_cluster.sls
index e543e5b..d718671 100644
--- a/tests/pillar/server_cluster.sls
+++ b/tests/pillar/server_cluster.sls
@@ -27,11 +27,12 @@
virtual_host: '/openstack'
# Workaround for https://bugs.launchpad.net/ceilometer/+bug/1337715
rpc_thread_pool_size: 5
- database:
- engine: mysql
- host: 127.0.0.1
- port: 3306
- name: aodh
- user: aodh
- password: test
-
+ database:
+ engine: mysql
+ host: 127.0.0.1
+ port: 3306
+ name: aodh
+ user: aodh
+ password: test
+ notifications:
+ store_events: default
diff --git a/tests/pillar/server_single.sls b/tests/pillar/server_single.sls
index 395a110..033bd64 100644
--- a/tests/pillar/server_single.sls
+++ b/tests/pillar/server_single.sls
@@ -19,14 +19,16 @@
message_queue:
engine: rabbitmq
host: 127.0.0.1
+ port: 5672
user: openstack
password: password
virtual_host: '/openstack'
database:
- engine: mysql
- host: 127.0.0.1
- port: 3306
- name: aodh
- user: aodh
- password: test
-
+ engine: mysql
+ host: 127.0.0.1
+ port: 3306
+ name: aodh
+ user: aodh
+ password: test
+ notifications:
+ store_events: default