From 8ca75f6d074b83ee48d9ce713cdb3e28e57d2cf8 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 28 Jan 2016 00:55:26 +0100 Subject: update module to make it work with all the new features of trocla 0.2.2 --- spec/classes/yaml_spec.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 spec/classes/yaml_spec.rb (limited to 'spec/classes/yaml_spec.rb') diff --git a/spec/classes/yaml_spec.rb b/spec/classes/yaml_spec.rb new file mode 100644 index 0000000..c5912f2 --- /dev/null +++ b/spec/classes/yaml_spec.rb @@ -0,0 +1,39 @@ +require File.expand_path(File.join(File.dirname(__FILE__),'../spec_helper')) + +describe 'trocla::yaml', :type => 'class' do + let(:facts){ + { + :domain => 'example.com', + } + } + context 'with default params' do + it { should contain_class('trocla::config').with( + 'store' => 'moneta', + 'store_options' => { + 'adapter' => 'YAML', + 'adapter_options' => { + 'file' => '/var/lib/trocla/trocla_data.yaml', + } + } + )} + it { should contain_file('/etc/puppet/troclarc.yaml').with_content("--- +profiles: + sysdomain_nc: + name_constraints: + - example.com +store: :moneta +store_options: + adapter: :YAML + adapter_options: + :file: /var/lib/trocla/trocla_data.yaml +") } + it { should contain_file('/var/lib/trocla/trocla_data.yaml').with( + :ensure => 'file', + :owner => 'puppet', + :group => 0, + :mode => '0600' + )} + it { should compile.with_all_deps } + end +end + -- cgit v1.2.3 From b478a4eb162d5a3a117c44ef9b49f20462facf50 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 29 Jan 2016 19:14:12 +0100 Subject: also manage directory as puppet user needs write perms as well --- spec/classes/yaml_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'spec/classes/yaml_spec.rb') diff --git a/spec/classes/yaml_spec.rb b/spec/classes/yaml_spec.rb index c5912f2..53ee507 100644 --- a/spec/classes/yaml_spec.rb +++ b/spec/classes/yaml_spec.rb @@ -27,6 +27,12 @@ store_options: adapter_options: :file: /var/lib/trocla/trocla_data.yaml ") } + it { should contain_file('/var/lib/trocla').with( + :ensure => 'directory', + :owner => 'puppet', + :group => 0, + :mode => '0600' + )} it { should contain_file('/var/lib/trocla/trocla_data.yaml').with( :ensure => 'file', :owner => 'puppet', -- cgit v1.2.3 From 9af8b4274e47b9c89be3368fa6981fd6ab464cb9 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 29 Jan 2016 19:33:23 +0100 Subject: make sure we manage things after the package --- spec/classes/yaml_spec.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'spec/classes/yaml_spec.rb') diff --git a/spec/classes/yaml_spec.rb b/spec/classes/yaml_spec.rb index 53ee507..9ded270 100644 --- a/spec/classes/yaml_spec.rb +++ b/spec/classes/yaml_spec.rb @@ -28,16 +28,18 @@ store_options: :file: /var/lib/trocla/trocla_data.yaml ") } it { should contain_file('/var/lib/trocla').with( - :ensure => 'directory', - :owner => 'puppet', - :group => 0, - :mode => '0600' + :ensure => 'directory', + :owner => 'puppet', + :group => 0, + :mode => '0600', + :require => 'Package[trocla]', )} it { should contain_file('/var/lib/trocla/trocla_data.yaml').with( - :ensure => 'file', - :owner => 'puppet', - :group => 0, - :mode => '0600' + :ensure => 'file', + :owner => 'puppet', + :group => 0, + :mode => '0600', + :require => 'Package[trocla]', )} it { should compile.with_all_deps } end -- cgit v1.2.3 From b19db630c21678afa2c9b7a7b67b9773f5a3e4d5 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 27 Mar 2016 12:32:49 +0200 Subject: make it 1.8.7 compatible --- spec/classes/yaml_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/classes/yaml_spec.rb') diff --git a/spec/classes/yaml_spec.rb b/spec/classes/yaml_spec.rb index 9ded270..49d2cb5 100644 --- a/spec/classes/yaml_spec.rb +++ b/spec/classes/yaml_spec.rb @@ -32,14 +32,14 @@ store_options: :owner => 'puppet', :group => 0, :mode => '0600', - :require => 'Package[trocla]', + :require => 'Package[trocla]' )} it { should contain_file('/var/lib/trocla/trocla_data.yaml').with( :ensure => 'file', :owner => 'puppet', :group => 0, :mode => '0600', - :require => 'Package[trocla]', + :require => 'Package[trocla]' )} it { should compile.with_all_deps } end -- cgit v1.2.3