|
180 | 180 | end |
181 | 181 |
|
182 | 182 | context 'testing compile mechanisms' do |
183 | | - describe '#build_catalog' do |
184 | | - before(:all) do |
185 | | - @temp_repo_dir = OctocatalogDiff::Spec.shell_script_for_envvar_testing('catalog') |
186 | | - end |
187 | | - |
188 | | - after(:all) do |
189 | | - FileUtils.rm_r(@temp_repo_dir) unless @temp_repo_dir.nil? || !Dir.exist?(@temp_repo_dir) |
190 | | - end |
191 | | - |
192 | | - # Catalog object currently builds with the order of command line options such that environment |
193 | | - # is last. The spec helper script looks at the last argument. Therefore set 'environment' to the |
194 | | - # name of the environment variable you with to obtain. |
195 | | - it 'should pass the HOME directory' do |
196 | | - opts = { |
197 | | - basedir: @temp_repo_dir, |
198 | | - puppet_binary: File.join(@temp_repo_dir, 'script', 'catalog'), |
199 | | - puppet_version: '3.8', |
200 | | - puppet_command: File.join(@temp_repo_dir, 'script', 'catalog') + ' HOME', |
201 | | - fact_file: OctocatalogDiff::Spec.fixture_path('facts/valid-facts.yaml'), |
202 | | - node: 'foonode', |
203 | | - branch: '.' |
204 | | - } |
205 | | - catalog = OctocatalogDiff::Catalog::Computed.new(opts.merge(environment: 'HOME')) |
206 | | - catalog.build |
207 | | - expect(catalog.error_message.strip).to eq(ENV['HOME']) |
208 | | - end |
209 | | - |
210 | | - it 'should clean the environment' do |
211 | | - ENV['THIS_IS_IN_MY_ENV'] = 'BLAH' |
212 | | - opts = { |
213 | | - basedir: @temp_repo_dir, |
214 | | - puppet_binary: File.join(@temp_repo_dir, 'script', 'catalog'), |
215 | | - puppet_version: '3.8', |
216 | | - puppet_command: File.join(@temp_repo_dir, 'script', 'catalog') + ' THIS_IS_IN_MY_ENV', |
217 | | - fact_file: OctocatalogDiff::Spec.fixture_path('facts/valid-facts.yaml'), |
218 | | - node: 'foonode', |
219 | | - branch: '.' |
220 | | - } |
221 | | - catalog = OctocatalogDiff::Catalog::Computed.new(opts.merge(environment: 'THIS_IS_IN_MY_ENV')) |
222 | | - catalog.build |
223 | | - expect(catalog.error_message.strip).to eq('') |
224 | | - end |
225 | | - |
226 | | - it 'should pass the environment variables in pass_env_vars' do |
227 | | - ENV['THIS_IS_IN_MY_ENV'] = 'BLAH' |
228 | | - opts = { |
229 | | - basedir: @temp_repo_dir, |
230 | | - puppet_binary: File.join(@temp_repo_dir, 'script', 'catalog'), |
231 | | - puppet_version: '3.8', |
232 | | - pass_env_vars: ['THIS_IS_IN_MY_ENV'], |
233 | | - puppet_command: File.join(@temp_repo_dir, 'script', 'catalog') + ' THIS_IS_IN_MY_ENV', |
234 | | - fact_file: OctocatalogDiff::Spec.fixture_path('facts/valid-facts.yaml'), |
235 | | - node: 'foonode', |
236 | | - branch: '.' |
237 | | - } |
238 | | - catalog = OctocatalogDiff::Catalog::Computed.new(opts.merge(environment: 'THIS_IS_IN_MY_ENV')) |
239 | | - catalog.build |
240 | | - expect(catalog.error_message.strip).to eq('BLAH') |
241 | | - end |
242 | | - end |
243 | | - |
244 | 183 | describe '#puppet_version' do |
245 | 184 | context 'with working Puppet version' do |
246 | 185 | before(:all) do |
|
0 commit comments