12c902f9e3b9a72aadb666e86e3f50436891252f
[integration/packaging/puppet-opendaylight.git] / spec / acceptance / class_spec.rb
1 require 'spec_helper_acceptance'
2
3 # Note that helpers (`should`, `be_running`...) are documented here:
4 # http://serverspec.org/resource_types.html
5 describe 'opendaylight class' do
6
7   context 'default parameters' do
8     # Using puppet_apply as a helper
9     it 'should work idempotently with no errors' do
10       pp = <<-EOS
11       class { 'opendaylight': }
12       EOS
13
14       # Run it twice and test for idempotency
15       apply_manifest(pp, :catch_failures => true)
16       apply_manifest(pp, :catch_changes  => true)
17     end
18
19     # TODO: It'd be nice to do this independently of install dir name
20     describe file('/opt/opendaylight-0.2.1/') do
21       it { should be_directory }
22       it { should be_owned_by 'odl' }
23       it { should be_grouped_into 'odl' }
24       it { should be_mode '775' }
25     end
26
27     # TODO: It'd be nice to do this independently of install dir name
28     describe file('/opt/opendaylight-0.2.1/etc/org.apache.karaf.features.cfg') do
29       it { should be_file }
30       it { should be_owned_by 'odl' }
31       it { should be_grouped_into 'odl' }
32       it { should be_mode '775' }
33       it { should contain 'featuresBoot' }
34     end
35
36     describe yumrepo('opendaylight') do
37       it { should exist }
38       it { should be_enabled }
39     end
40
41     describe package('opendaylight') do
42       it { should be_installed }
43     end
44
45     describe service('opendaylight') do
46       it { should be_enabled }
47       it { should be_enabled.with_level(3) }
48       it { should be_running }
49     end
50
51     # OpenDaylight will appear as a Java process
52     describe process('java') do
53       it { should be_running }
54     end
55
56     describe user('odl') do
57       it { should exist }
58       it { should belong_to_group 'odl' }
59       it { should have_home_directory '/opt/opendaylight-0.2.1' }
60     end
61
62     describe file('/home/odl') do
63       # Home dir shouldn't be created for odl user
64       it { should_not be_directory }
65     end
66   end
67 end