Upgrade from Helium SR1.1 to SR2. Closes #31
[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.2/') 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.2/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     # TODO: It'd be nice to do this independently of install dir name
57     describe user('odl') do
58       it { should exist }
59       it { should belong_to_group 'odl' }
60       it { should have_home_directory '/opt/opendaylight-0.2.2' }
61     end
62
63     describe file('/home/odl') do
64       # Home dir shouldn't be created for odl user
65       it { should_not be_directory }
66     end
67
68     describe file('/usr/lib/systemd/system/opendaylight.service') do
69       it { should be_file }
70       it { should be_owned_by 'root' }
71       it { should be_grouped_into 'root' }
72       it { should be_mode '644' }
73     end
74   end
75 end