|
87 | 87 | end |
88 | 88 |
|
89 | 89 | describe 'ENC override integration with --to-enc-override' do |
| 90 | + before(:all) do |
| 91 | + @result = OctocatalogDiff::Integration.integration( |
| 92 | + spec_repo: 'enc-overrides', |
| 93 | + spec_fact_file: 'valid-facts.yaml', |
| 94 | + hiera_config: 'hiera.yaml', |
| 95 | + hiera_path: 'hieradata', |
| 96 | + argv: [ |
| 97 | + '--no-parallel', |
| 98 | + '--enc', |
| 99 | + OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'), |
| 100 | + '--to-enc-override', 'role=two' |
| 101 | + ] |
| 102 | + ) |
| 103 | + end |
| 104 | + |
| 105 | + it 'should succeed' do |
| 106 | + expect(@result.exitcode).not_to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 107 | + expect(@result.exitcode).to eq(2), "Runtime error: #{@result.logs}" |
| 108 | + end |
| 109 | + |
| 110 | + it 'should show expected changes' do |
| 111 | + diffs = @result.diffs.map { |x| OctocatalogDiff::Spec.remove_file_and_line(x) } |
| 112 | + expect(diffs).to include( |
| 113 | + diff_type: '~', |
| 114 | + type: 'File', |
| 115 | + title: '/tmp/one', |
| 116 | + structure: %w(parameters content), |
| 117 | + old_value: 'one', |
| 118 | + new_value: 'two' |
| 119 | + ) |
| 120 | + expect(diffs).to include( |
| 121 | + diff_type: '~', |
| 122 | + type: 'File', |
| 123 | + title: '/tmp/two', |
| 124 | + structure: %w(parameters content), |
| 125 | + old_value: 'one', |
| 126 | + new_value: 'two' |
| 127 | + ) |
| 128 | + end |
| 129 | + |
| 130 | + it 'should log proper messages' do |
| 131 | + expect(@result.log_messages).to include('DEBUG - ENC override: role = "two"') |
| 132 | + end |
90 | 133 | end |
91 | 134 |
|
92 | 135 | describe 'ENC override integration with --from-enc-override' do |
| 136 | + before(:all) do |
| 137 | + @result = OctocatalogDiff::Integration.integration( |
| 138 | + spec_repo: 'enc-overrides', |
| 139 | + spec_fact_file: 'valid-facts.yaml', |
| 140 | + hiera_config: 'hiera.yaml', |
| 141 | + hiera_path: 'hieradata', |
| 142 | + argv: [ |
| 143 | + '--no-parallel', |
| 144 | + '--enc', |
| 145 | + OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'), |
| 146 | + '--from-enc-override', 'role=two' |
| 147 | + ] |
| 148 | + ) |
| 149 | + end |
| 150 | + |
| 151 | + it 'should succeed' do |
| 152 | + expect(@result.exitcode).not_to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 153 | + expect(@result.exitcode).to eq(2), "Runtime error: #{@result.logs}" |
| 154 | + end |
| 155 | + |
| 156 | + it 'should show expected changes' do |
| 157 | + diffs = @result.diffs.map { |x| OctocatalogDiff::Spec.remove_file_and_line(x) } |
| 158 | + expect(diffs).to include( |
| 159 | + diff_type: '~', |
| 160 | + type: 'File', |
| 161 | + title: '/tmp/one', |
| 162 | + structure: %w(parameters content), |
| 163 | + old_value: 'two', |
| 164 | + new_value: 'one' |
| 165 | + ) |
| 166 | + expect(diffs).to include( |
| 167 | + diff_type: '~', |
| 168 | + type: 'File', |
| 169 | + title: '/tmp/two', |
| 170 | + structure: %w(parameters content), |
| 171 | + old_value: 'two', |
| 172 | + new_value: 'one' |
| 173 | + ) |
| 174 | + end |
| 175 | + |
| 176 | + it 'should log proper messages' do |
| 177 | + expect(@result.log_messages).to include('DEBUG - ENC override: role = "two"') |
| 178 | + end |
93 | 179 | end |
94 | 180 |
|
95 | 181 | describe 'ENC override integration with catalog compilation only' do |
| 182 | + before(:all) do |
| 183 | + @result = OctocatalogDiff::Integration.integration( |
| 184 | + spec_repo: 'enc-overrides', |
| 185 | + spec_fact_file: 'valid-facts.yaml', |
| 186 | + hiera_config: 'hiera.yaml', |
| 187 | + hiera_path: 'hieradata', |
| 188 | + argv: [ |
| 189 | + '--no-parallel', |
| 190 | + '--enc', |
| 191 | + OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'), |
| 192 | + '--enc-override', 'role=two', |
| 193 | + '--catalog-only' |
| 194 | + ] |
| 195 | + ) |
| 196 | + end |
| 197 | + |
| 198 | + it 'should succeed' do |
| 199 | + expect(@result.exitcode).not_to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 200 | + expect(@result.exitcode).to eq(0), "Runtime error: #{@result.logs}" |
| 201 | + end |
| 202 | + |
| 203 | + it 'should show no changes' do |
| 204 | + expect(@result.to).to eq([]) |
| 205 | + end |
| 206 | + |
| 207 | + it 'should log proper messages' do |
| 208 | + expect(@result.log_messages).to include('DEBUG - ENC override: role = "two"') |
| 209 | + end |
96 | 210 | end |
0 commit comments