|
56 | 56 | '--no-parallel', |
57 | 57 | '--enc', |
58 | 58 | OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'), |
59 | | - '--enc-override', 'role=two' |
| 59 | + '--enc-override', 'parameters::role=two' |
60 | 60 | ] |
61 | 61 | ) |
62 | 62 | end |
|
97 | 97 | '--no-parallel', |
98 | 98 | '--enc', |
99 | 99 | OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'), |
100 | | - '--to-enc-override', 'role=two' |
| 100 | + '--to-enc-override', 'parameters::role=two' |
101 | 101 | ] |
102 | 102 | ) |
103 | 103 | end |
|
143 | 143 | '--no-parallel', |
144 | 144 | '--enc', |
145 | 145 | OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'), |
146 | | - '--from-enc-override', 'role=two' |
| 146 | + '--from-enc-override', 'parameters::role=two' |
147 | 147 | ] |
148 | 148 | ) |
149 | 149 | end |
|
189 | 189 | '--no-parallel', |
190 | 190 | '--enc', |
191 | 191 | OctocatalogDiff::Spec.fixture_path('repos/enc-overrides/enc.sh'), |
192 | | - '--enc-override', 'role=two', |
| 192 | + '--enc-override', 'parameters::role=two', |
193 | 193 | '--catalog-only' |
194 | 194 | ] |
195 | 195 | ) |
|
208 | 208 | expect(@result.log_messages).to include('DEBUG - ENC override: role = "two"') |
209 | 209 | end |
210 | 210 | end |
| 211 | + |
| 212 | +describe 'ENC override via CLI' do |
| 213 | + before(:all) do |
| 214 | + @result = OctocatalogDiff::Integration.integration_cli( |
| 215 | + [ |
| 216 | + '-n', 'rspec-node.github.net', |
| 217 | + '--bootstrapped-to-dir', OctocatalogDiff::Spec.fixture_path('repos/enc-overrides'), |
| 218 | + '--bootstrapped-from-dir', OctocatalogDiff::Spec.fixture_path('repos/enc-overrides'), |
| 219 | + '--to-enc-override', 'parameters::role=two', |
| 220 | + '--output-format', 'json', |
| 221 | + '--fact-file', OctocatalogDiff::Spec.fixture_path('facts/valid-facts.yaml'), |
| 222 | + '--hiera-config', 'hiera.yaml', |
| 223 | + '--hiera-path', 'hieradata', |
| 224 | + '--puppet-binary', OctocatalogDiff::Spec::PUPPET_BINARY, |
| 225 | + '-d' |
| 226 | + ] |
| 227 | + ) |
| 228 | + end |
| 229 | + |
| 230 | + it 'should exit with status 2' do |
| 231 | + expect(@result.exitcode).to eq(2), @result.stderr |
| 232 | + end |
| 233 | + |
| 234 | + it 'should contain the correct diffs' do |
| 235 | + parse_result = JSON.parse(@result.stdout)['diff'].map { |x| OctocatalogDiff::Spec.remove_file_and_line(x) } |
| 236 | + expect(parse_result.size).to eq(2) |
| 237 | + expect(parse_result).to include( |
| 238 | + diff_type: '~', |
| 239 | + type: 'File', |
| 240 | + title: '/tmp/one', |
| 241 | + structure: %w(parameters content), |
| 242 | + old_value: 'two', |
| 243 | + new_value: 'one' |
| 244 | + ) |
| 245 | + expect(parse_result).to include( |
| 246 | + diff_type: '~', |
| 247 | + type: 'File', |
| 248 | + title: '/tmp/two', |
| 249 | + structure: %w(parameters content), |
| 250 | + old_value: 'two', |
| 251 | + new_value: 'one' |
| 252 | + ) |
| 253 | + end |
| 254 | + |
| 255 | + it 'should log the correct messages' do |
| 256 | + expect(@result.stderr).to match(/Catalog for . will be built with OctocatalogDiff::Catalog::Computed/) |
| 257 | + expect(@result.stderr).to match(/Override ipaddress from "10.20.30.40" to "10.30.50.70"/) |
| 258 | + expect(@result.stderr).to match(/Override foofoo from nil to "barbar"/) |
| 259 | + expect(@result.stderr).to match(/Diffs computed for rspec-node.github.net/) |
| 260 | + end |
| 261 | +end |
0 commit comments