Merge pull request #3 from Martin819/master
Added Kitchen tests and Travis
diff --git a/.kitchen.yml b/.kitchen.yml
new file mode 100644
index 0000000..ca383ea
--- /dev/null
+++ b/.kitchen.yml
@@ -0,0 +1,43 @@
+---
+driver:
+ name: docker
+ hostname: postgresql.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: postgresql
+ grains:
+ noservices: True
+ state_top:
+ base:
+ "*":
+ - postgresql
+ pillars:
+ top.sls:
+ base:
+ "*":
+ - postgresql
+
+verifier:
+ name: inspec
+ sudo: true
+
+platforms:
+ - name: <%=ENV['PLATFORM'] || 'ubuntu-xenial'%>
+ driver_config:
+ image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
+ platform: ubuntu
+
+suites:
+
+ - name: postgresql_server
+ provisioner:
+ pillars-from-files:
+ postgresql.sls: tests/pillar/postgresql_server.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..4f34af2
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,40 @@
+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
+ - 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/tests/pillar/postgresql_server.sls b/tests/pillar/postgresql_server.sls
index f4ae1f5..0cf7f27 100644
--- a/tests/pillar/postgresql_server.sls
+++ b/tests/pillar/postgresql_server.sls
@@ -1,5 +1,11 @@
postgresql:
server:
+ clients:
+ - 127.0.0.1
+ bind:
+ address: 127.0.0.1
+ port: 5432
+ protocol: tcp
enabled: true
database:
testing:
@@ -10,4 +16,5 @@
- name: test
password: test
host: localhost
+ createdb: true
rights: all privileges