From 45394feb991b2bea33ba302bb66b70e0eaa7cc9d Mon Sep 17 00:00:00 2001 From: Niels Abspoel Date: Sat, 22 Dec 2018 16:00:15 +0100 Subject: [PATCH] add initial travis integration add travis button to README --- .kitchen.yml | 76 ++++++++++++++++++++++++ .travis.yml | 19 ++++++ Gemfile | 7 +++ README.rst | 4 ++ test/integration/default/pkgs_spec.rb | 11 ++++ test/integration/default/service_spec.rb | 14 +++++ 6 files changed, 131 insertions(+) create mode 100644 .kitchen.yml create mode 100644 .travis.yml create mode 100644 Gemfile create mode 100644 test/integration/default/pkgs_spec.rb create mode 100644 test/integration/default/service_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml new file mode 100644 index 0000000..8ce430b --- /dev/null +++ b/.kitchen.yml @@ -0,0 +1,76 @@ +--- +driver: + name: docker + +driver_config: + use_sudo: false + privileged: true + provision_command: mkdir -p /run/sshd + run_command: /lib/systemd/systemd + +platforms: + - name: debian-9 + driver_config: + provision_command: + - apt-get install udev net-tools -y + - name: ubuntu-18.04 + driver_config: + provision_command: + - apt-get install udev net-tools -y + - name: centos-7 + driver_config: + provision_command: + - yum install udev net-tools -y + +provisioner: + name: salt_solo + log_level: info + require_chef: false + salt_version: latest + formula: salt + salt_copy_filter: + - .kitchen + - .git + pillars: + top.sls: + base: + '*': + - salt + salt.sls: + salt: + master: + fileserver_backend: + - rootfs + file_roots: + base: + - /srv/salt + pillar_roots: + base: + - /srv/pillar + minion: + master: localhost + fileserver_backend: + - rootfs + file_roots: + base: + - /srv/salt + pillar_roots: + base: + - /srv/pillar + +verifier: + name: inspec + sudo: true + reporter: + - cli + inspec_tests: + - path: test/integration/default + +suites: + - name: salt + provisioner: + state_top: + base: + '*': + - salt.master + - salt.minion diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..233fe5c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +sudo: required +cache: bundler +language: ruby + +services: + - docker + +before_install: + - bundle install + +env: + matrix: + - INSTANCE: salt-debian-9 + - INSTANCE: salt-ubuntu-1804 + - INSTANCE: salt-centos-7 + +script: + - bundle exec kitchen verify ${INSTANCE} + diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..d177b65 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source "https://rubygems.org" + +gem "test-kitchen", '>=1.23.2' +gem "kitchen-docker" +gem "kitchen-salt", ">=0.2.5" +gem "kitchen-inspec" + diff --git a/README.rst b/README.rst index 63d47ff..a8ff8ef 100644 --- a/README.rst +++ b/README.rst @@ -2,6 +2,9 @@ salt ==== +.. image:: https://travis-ci.com/saltstack-formulas/salt-formula.svg?branch=master + :target: https://travis-ci.com/saltstack-formulas + Yes, Salt can Salt itself! .. note:: @@ -9,6 +12,7 @@ Yes, Salt can Salt itself! See the full `Salt Formulas installation and usage instructions `_. + Available states ================ diff --git a/test/integration/default/pkgs_spec.rb b/test/integration/default/pkgs_spec.rb new file mode 100644 index 0000000..c5e67db --- /dev/null +++ b/test/integration/default/pkgs_spec.rb @@ -0,0 +1,11 @@ +control 'salt packages' do + title 'should be installed' + + describe package('salt-master') do + it { should be_installed } + end + + describe package('salt-minion') do + it { should be_installed } + end +end diff --git a/test/integration/default/service_spec.rb b/test/integration/default/service_spec.rb new file mode 100644 index 0000000..1446b04 --- /dev/null +++ b/test/integration/default/service_spec.rb @@ -0,0 +1,14 @@ +control 'salt services' do + title 'should be running' + + describe service('salt-master') do + it { should be_enabled } + it { should be_running } + end + + describe service('salt-minion') do + it { should be_enabled } + it { should be_running } + end + +end