|
27 | 27 | }
|
28 | 28 | }
|
29 | 29 | end
|
| 30 | + let(:pre_condition) do |
| 31 | + <<-PRE_COND |
| 32 | + define puppet_enterprise::deprecated_parameter() {} |
| 33 | +
|
| 34 | + include pe_databases |
| 35 | + PRE_COND |
| 36 | + end |
30 | 37 |
|
31 | 38 | on_supported_os.each do |os, os_facts|
|
32 | 39 | context "on #{os}" do
|
33 |
| - let(:pre_condition) do |
34 |
| - <<-PRE_COND |
35 |
| - define puppet_enterprise::deprecated_parameter() {} |
36 |
| -
|
37 |
| - include pe_databases |
38 |
| - PRE_COND |
39 |
| - end |
40 | 40 | let(:facts) { os_facts }
|
41 | 41 |
|
42 | 42 | it { is_expected.to compile }
|
43 | 43 | end
|
44 | 44 | end
|
45 | 45 |
|
46 | 46 | context 'with default parameters' do
|
47 |
| - let(:pre_condition) do |
48 |
| - <<-PRE_COND |
49 |
| - define puppet_enterprise::deprecated_parameter() {} |
50 |
| -
|
51 |
| - include pe_databases |
52 |
| - PRE_COND |
53 |
| - end |
54 |
| - |
55 | 47 | it {
|
56 | 48 | tables_hash.each do |name, val|
|
57 | 49 | is_expected.to contain_pe_databases__collect(name).with(
|
58 | 50 | disable_maintenance: false,
|
59 |
| - command: "#{repack_cmd} #{val[:database]}", |
| 51 | + command: "#{repack_cmd} --elevel DEBUG --echo #{val[:database]}", |
60 | 52 | # Strip the backslash character because this is not a regex
|
61 | 53 | on_cal: (val[:schedule]).to_s.tr('\\', ''),
|
62 | 54 | )
|
|
66 | 58 |
|
67 | 59 | is_expected.to contain_file("/etc/systemd/system/pe_databases-#{name}.timer").with_content(%r{OnCalendar=#{val[:schedule]}})
|
68 | 60 | is_expected.to contain_file("/etc/systemd/system/pe_databases-#{name}.service").with_content(
|
69 |
| - %r{ExecStart=#{repack_cmd} #{val[:database]} #{val[:tables]}}, |
| 61 | + %r{ExecStart=#{repack_cmd} --elevel DEBUG --echo #{val[:database]} #{val[:tables]}}, |
70 | 62 | )
|
71 | 63 |
|
72 | 64 | [
|
@@ -103,4 +95,21 @@ class {'pe_databases': facts_tables_repack_timer => 'Tue *-*-* 04:20:00'}
|
103 | 95 | )
|
104 | 96 | }
|
105 | 97 | end
|
| 98 | + |
| 99 | + context 'when customizing log parameters' do |
| 100 | + # Load the rspec hieradata. This data sets repack_log_level: 'INFO' and enable_echo: false |
| 101 | + let(:hiera_config) { 'hiera-rspec.yaml' } |
| 102 | + |
| 103 | + it { |
| 104 | + # The command should have --elevel INFO and not contain --echo according to the hieradata |
| 105 | + is_expected.to contain_pe_databases__collect('facts').with( |
| 106 | + command: "#{repack_cmd} --elevel INFO #{tables_hash[:facts][:database]}", |
| 107 | + ) |
| 108 | + |
| 109 | + # The service file should have --elevel INFO and not contain --echo according to the hieradata |
| 110 | + is_expected.to contain_file('/etc/systemd/system/pe_databases-facts.service').with_content( |
| 111 | + %r{ExecStart=#{repack_cmd} --elevel INFO #{tables_hash[:facts][:database]} #{tables_hash[:facts][:tables]}}, |
| 112 | + ) |
| 113 | + } |
| 114 | + end |
106 | 115 | end
|
0 commit comments