3 describe 'opendaylight' do
4 context 'supported operating systems' do
6 ['20', '21'].each do |operatingsystemmajrelease|
7 operatingsystem = 'Fedora'
8 describe "opendaylight class without any params on #{osfamily}:#{operatingsystem} #{operatingsystemmajrelease}" do
11 :osfamily => osfamily,
12 :operatingsystem => operatingsystem,
13 :operatingsystemmajrelease => operatingsystemmajrelease,
16 # Confirm that module compiles
18 it { should compile.with_all_deps }
20 # Confirm presence of classes
21 it { should contain_class('opendaylight') }
22 it { should contain_class('opendaylight::params') }
23 it { should contain_class('opendaylight::install') }
24 it { should contain_class('opendaylight::config') }
25 it { should contain_class('opendaylight::service') }
27 # Confirm relationships between classes
28 it { should contain_class('opendaylight::install').that_comes_before('opendaylight::config') }
29 it { should contain_class('opendaylight::config').that_requires('opendaylight::install') }
30 it { should contain_class('opendaylight::config').that_notifies('opendaylight::service') }
31 it { should contain_class('opendaylight::service').that_subscribes_to('opendaylight::config') }
32 it { should contain_class('opendaylight::service').that_comes_before('opendaylight') }
33 it { should contain_class('opendaylight').that_requires('opendaylight::service') }
35 # Confirm presense of other resources
36 it { should contain_service('opendaylight') }
37 it { should contain_yumrepo('opendaylight') }
38 it { should contain_package('opendaylight') }
40 # Confirm relationships between other resources
41 it { should contain_package('opendaylight').that_requires('Yumrepo[opendaylight]') }
42 it { should contain_yumrepo('opendaylight').that_comes_before('Package[opendaylight]') }
44 # Confirm properties of other resources
45 # There's a more elegant way to do these long sets of checks
46 # using multi-line hashes, but it breaks in Ruby 1.8.7
47 it { should contain_yumrepo('opendaylight').with_enabled('1').with_gpgcheck('0').with_descr('OpenDaylight SDN controller').with_baseurl('https://copr-be.cloud.fedoraproject.org/results/dfarrell07/OpenDaylight/fedora-$releasever-$basearch/') }
48 it { should contain_package('opendaylight').with_ensure('present') }
49 it { should contain_service('opendaylight').with_ensure('running').with_enable('true').with_hasstatus('true').with_hasrestart('true') }
52 ['7'].each do |operatingsystemmajrelease|
53 operatingsystem = 'CentOS'
54 describe "opendaylight class without any params on #{osfamily}:#{operatingsystem} #{operatingsystemmajrelease}" do
57 :osfamily => osfamily,
58 :operatingsystem => operatingsystem,
59 :operatingsystemmajrelease => operatingsystemmajrelease,
62 # Confirm that module compiles
64 it { should compile.with_all_deps }
66 # Confirm presence of classes
67 it { should contain_class('opendaylight') }
68 it { should contain_class('opendaylight::params') }
69 it { should contain_class('opendaylight::install') }
70 it { should contain_class('opendaylight::config') }
71 it { should contain_class('opendaylight::service') }
73 # Confirm relationships between classes
74 it { should contain_class('opendaylight::install').that_comes_before('opendaylight::config') }
75 it { should contain_class('opendaylight::config').that_requires('opendaylight::install') }
76 it { should contain_class('opendaylight::config').that_notifies('opendaylight::service') }
77 it { should contain_class('opendaylight::service').that_subscribes_to('opendaylight::config') }
78 it { should contain_class('opendaylight::service').that_comes_before('opendaylight') }
79 it { should contain_class('opendaylight').that_requires('opendaylight::service') }
81 # Confirm presense of other resources
82 it { should contain_service('opendaylight') }
83 it { should contain_yumrepo('opendaylight') }
84 it { should contain_package('opendaylight') }
86 # Confirm relationships between other resources
87 it { should contain_package('opendaylight').that_requires('Yumrepo[opendaylight]') }
88 it { should contain_yumrepo('opendaylight').that_comes_before('Package[opendaylight]') }
90 # Confirm properties of other resources
91 # There's a more elegant way to do these long sets of checks
92 # using multi-line hashes, but it breaks in Ruby 1.8.7
93 it { should contain_yumrepo('opendaylight').with_enabled('1').with_gpgcheck('0').with_descr('OpenDaylight SDN controller').with_baseurl('https://copr-be.cloud.fedoraproject.org/results/dfarrell07/OpenDaylight/epel-7-$basearch/') }
94 it { should contain_package('opendaylight').with_ensure('present') }
95 it { should contain_service('opendaylight').with_ensure('running').with_enable('true').with_hasstatus('true').with_hasrestart('true') }
100 context 'unsupported operating systems' do
101 # Test unsupported versions of Fedora
102 ['18', '19', '22'].each do |operatingsystemmajrelease|
104 operatingsystem = 'Fedora'
105 describe "opendaylight class without any params on #{osfamily}:#{operatingsystem} #{operatingsystemmajrelease}" do
107 :osfamily => osfamily,
108 :operatingsystem => operatingsystem,
109 :operatingsystemmajrelease => operatingsystemmajrelease,
112 # Confirm that classes fail on unsupported OSs
113 it { expect { should contain_class('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
114 it { expect { should contain_class('opendaylight::install') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
115 it { expect { should contain_class('opendaylight::config') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
116 it { expect { should contain_class('opendaylight::service') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
118 # Confirm that other resources fail on unsupported OSs
119 it { expect { should contain_yumrepo('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
120 it { expect { should contain_package('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
121 it { expect { should contain_service('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
125 # Test unsupported versions of CentOS
126 ['5', '6', '8'].each do |operatingsystemmajrelease|
128 operatingsystem = 'CentOS'
129 describe "opendaylight class without any params on #{osfamily}:#{operatingsystem} #{operatingsystemmajrelease}" do
131 :osfamily => osfamily,
132 :operatingsystem => operatingsystem,
133 :operatingsystemmajrelease => operatingsystemmajrelease,
136 # Confirm that classes fail on unsupported OSs
137 it { expect { should contain_class('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
138 it { expect { should contain_class('opendaylight::install') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
139 it { expect { should contain_class('opendaylight::config') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
140 it { expect { should contain_class('opendaylight::service') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
142 # Confirm that other resources fail on unsupported OSs
143 it { expect { should contain_yumrepo('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
144 it { expect { should contain_package('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
145 it { expect { should contain_service('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS: #{operatingsystem} #{operatingsystemmajrelease}/) }
149 # Test unsupported OS families
150 ['Debian', 'Suse', 'Solaris'].each do |osfamily|
151 describe "opendaylight class without any params on #{osfamily}" do
153 :osfamily => osfamily,
156 # Confirm that classes fail on unsupported OS families
157 it { expect { should contain_class('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS family: #{osfamily}/) }
158 it { expect { should contain_class('opendaylight::install') }.to raise_error(Puppet::Error, /Unsupported OS family: #{osfamily}/) }
159 it { expect { should contain_class('opendaylight::config') }.to raise_error(Puppet::Error, /Unsupported OS family: #{osfamily}/) }
160 it { expect { should contain_class('opendaylight::service') }.to raise_error(Puppet::Error, /Unsupported OS family: #{osfamily}/) }
162 # Confirm that other resources fail on unsupported OS families
163 it { expect { should contain_yumrepo('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS family: #{osfamily}/) }
164 it { expect { should contain_package('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS family: #{osfamily}/) }
165 it { expect { should contain_service('opendaylight') }.to raise_error(Puppet::Error, /Unsupported OS family: #{osfamily}/) }