From d3ce57c8f06ca13fc939f4091580e78f7e268fd6 Mon Sep 17 00:00:00 2001 From: Eric Veiras Galisson Date: Wed, 18 Dec 2019 14:10:22 +0100 Subject: [PATCH] test: add test for config_files --- kitchen.yml | 6 ++++++ test/integration/default/controls/config.rb | 11 +++++++++++ test/salt/files/rabbitmq/rabbitmq.conf | 1 + 3 files changed, 18 insertions(+) create mode 100644 test/integration/default/controls/config.rb create mode 100644 test/salt/files/rabbitmq/rabbitmq.conf diff --git a/kitchen.yml b/kitchen.yml index 8854d698..b6f57819 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -182,6 +182,7 @@ suites: base: '*': - rabbitmq + - rabbitmq.config_files pillars: top.sls: base: @@ -189,6 +190,10 @@ suites: - rabbitmq pillars_from_files: rabbitmq.sls: pillar.example + dependencies: + - name: files + path: ./test/salt + verifier: inspec_tests: - path: test/integration/default @@ -198,6 +203,7 @@ suites: base: '*': - rabbitmq.latest + - rabbitmq.config_files pillars: top.sls: base: diff --git a/test/integration/default/controls/config.rb b/test/integration/default/controls/config.rb new file mode 100644 index 00000000..5b7a5197 --- /dev/null +++ b/test/integration/default/controls/config.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +control 'rabbitmq configuration' do + title 'should match desired lines' + + describe file('/etc/rabbitmq/rabbitmq.conf') do + it { should exist } + it { should be_file } + its('content') { should include '# Config file for rabbitmq' } + end +end diff --git a/test/salt/files/rabbitmq/rabbitmq.conf b/test/salt/files/rabbitmq/rabbitmq.conf new file mode 100644 index 00000000..7843c775 --- /dev/null +++ b/test/salt/files/rabbitmq/rabbitmq.conf @@ -0,0 +1 @@ +# Config file for rabbitmq