|
120 | 120 | end |
121 | 121 | end |
122 | 122 |
|
123 | | - # There are a lot of special cases here, so it is best to have a separate |
124 | | - # unit test context for them. |
125 | | - context 'distro tag on Fedora platforms' do |
126 | | - def sets_distro_tag_to(expected_distro_tag) |
127 | | - is_expected.to contain_package('puppet-agent').with_ensure( |
128 | | - "#{params[:package_version]}-1.#{expected_distro_tag}" |
129 | | - ) |
130 | | - end |
131 | | - |
132 | | - let(:facts) do |
133 | | - super().merge(:operatingsystem => 'Fedora') |
134 | | - end |
135 | | - |
136 | | - context 'when the collection is PC1' do |
137 | | - let(:params) do |
138 | | - # Older agents use the PC1 collection, so set the package_version |
139 | | - # to 1.10.9 to simulate this. |
140 | | - super().merge(:collection => 'PC1', :package_version => '1.10.9') |
141 | | - end |
142 | | - |
143 | | - let(:facts) do |
144 | | - # Older agents do not support anything past Fedora 27 |
145 | | - super().merge(:operatingsystemmajrelease => 27) |
146 | | - end |
147 | | - |
148 | | - it { sets_distro_tag_to('fedoraf27') } |
149 | | - end |
150 | | - |
151 | | - context 'when the collection is puppet5' do |
152 | | - let(:params) do |
153 | | - super().merge(:collection => 'puppet5') |
154 | | - end |
155 | | - |
156 | | - context 'on newer Fedora versions' do |
157 | | - let(:facts) do |
158 | | - super().merge(:operatingsystemmajrelease => 28) |
159 | | - end |
160 | | - |
161 | | - it { sets_distro_tag_to('fc28') } |
162 | | - end |
163 | | - |
164 | | - context 'on older Fedora versions' do |
165 | | - let(:facts) do |
166 | | - super().merge(:operatingsystemmajrelease => 27) |
167 | | - end |
168 | | - |
169 | | - shared_examples 'a package version' do |package_version, distro_tag| |
170 | | - let(:params) do |
171 | | - super().merge(:package_version => package_version) |
172 | | - end |
173 | | - |
174 | | - it { sets_distro_tag_to(distro_tag) } |
175 | | - end |
176 | | - |
177 | | - context 'when package_version > 5.5.3' do |
178 | | - include_examples 'a package version', '5.5.4', 'fedora27' |
179 | | - end |
180 | | - |
181 | | - context 'when package_version == 5.5.3' do |
182 | | - include_examples 'a package version', '5.5.3', 'fedoraf27' |
183 | | - end |
184 | | - |
185 | | - context 'when package_version < 5.5.3' do |
186 | | - include_examples 'a package version', '5.5.1', 'fedoraf27' |
187 | | - end |
188 | | - end |
189 | | - end |
190 | | - |
191 | | - context 'when the collection is newer than PC1 and puppet5' do |
192 | | - let(:params) do |
193 | | - super().merge(:collection => 'puppet6', :package_version => '6.0.0') |
194 | | - end |
195 | | - |
196 | | - let(:facts) do |
197 | | - super().merge(:operatingsystemmajrelease => 27) |
198 | | - end |
199 | | - |
200 | | - it { sets_distro_tag_to('fc27') } |
201 | | - end |
202 | | - end |
203 | | - |
204 | 123 | [['RedHat', 'el-7-x86_64', 'el-7-x86_64', 7], ['Amazon', '', 'el-6-x64', 6]].each do |os, tag, repodir, osmajor| |
205 | 124 | context "when PE on #{os}" do |
206 | 125 | before(:each) do |
@@ -290,7 +209,7 @@ def sets_distro_tag_to(expected_distro_tag) |
290 | 209 | :package_version => package_version |
291 | 210 | } |
292 | 211 | } |
293 | | - it { is_expected.to contain_package('puppet-agent').with_ensure("#{params[:package_version]}-1.el#{osmajor}") } |
| 212 | + it { is_expected.to contain_package('puppet-agent').with_ensure("#{params[:package_version]}") } |
294 | 213 |
|
295 | 214 | end |
296 | 215 |
|
|
0 commit comments