Skip to content

Commit 290fb3d

Browse files
committed
Fix tests
* Add `fixtures.yml`. * Add `default_module_facts.yml` with `staging_http_get` fact. * Rubocop fixes in `spec/classes/example_spec.rb`. * Remove completely broken tests. Looks like there aren't really any tests and `spec/classes/example_spec.rb` is just boilerplate/skeleton. For instance there is no `config.pp` manifest, so ```ruby it { is_expected.to contain_class('splunk::config') } ``` was never going to pass! Signed-off-by: Alexander Fisher <alex@linfratech.co.uk>
1 parent 105bd23 commit 290fb3d

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.fixtures.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fixtures:
2+
repositories:
3+
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
4+
inifile: 'https://github.com/puppetlabs/puppetlabs-inifile.git'
5+
staging: 'https://github.com/voxpupuli/puppet-staging.git'
6+
symlinks:
7+
splunk: "#{source_dir}"

spec/classes/example_spec.rb

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
facts
99
end
1010

11-
context "splunk class without any parameters" do
11+
context 'splunk class without any parameters' do
1212
it { is_expected.to compile.with_all_deps }
1313

1414
it { is_expected.to contain_class('splunk::params') }
15-
it { is_expected.to contain_class('splunk::install').that_comes_before('splunk::config') }
16-
it { is_expected.to contain_class('splunk::config') }
17-
it { is_expected.to contain_class('splunk::service').that_subscribes_to('splunk::config') }
1815

1916
it { is_expected.to contain_service('splunk') }
20-
it { is_expected.to contain_package('splunk').with_ensure('present') }
17+
it { is_expected.to contain_package('splunk').with_ensure('installed') }
2118
end
2219
end
2320
end
@@ -27,12 +24,14 @@
2724
describe 'splunk class without any parameters on Solaris/Nexenta' do
2825
let(:facts) do
2926
{
30-
:osfamily => 'Solaris',
31-
:operatingsystem => 'Nexenta',
27+
osfamily: 'Solaris',
28+
operatingsystem: 'Nexenta',
29+
kernel: 'SunOS',
30+
architecture: 'sparc'
3231
}
3332
end
3433

35-
it { expect { is_expected.to contain_package('splunk') }.to raise_error(Puppet::Error, /Nexenta not supported/) }
34+
it { expect { is_expected.to contain_package('splunk') }.to raise_error(Puppet::Error, %r{unsupported osfamily/arch Solaris/sparc}) }
3635
end
3736
end
3837
end

spec/default_module_facts.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
staging_http_get: 'curl'

0 commit comments

Comments
 (0)