|
147 | 147 | end |
148 | 148 | end |
149 | 149 |
|
| 150 | + context 'with option auto-disabled' do |
| 151 | + before(:all) do |
| 152 | + @result = OctocatalogDiff::Integration.integration_cli( |
| 153 | + [ |
| 154 | + '--fact-file', OctocatalogDiff::Spec.fixture_path('facts/facts.yaml'), |
| 155 | + '--catalog-only', |
| 156 | + '-n', 'rspec-node.github.net', |
| 157 | + '--compare-file-text', |
| 158 | + '--basedir', OctocatalogDiff::Spec.fixture_path('repos/convert-resources/new'), |
| 159 | + '--puppet-binary', OctocatalogDiff::Spec::PUPPET_BINARY, |
| 160 | + '--debug' |
| 161 | + ] |
| 162 | + ) |
| 163 | + end |
| 164 | + |
| 165 | + it 'should compile the catalog' do |
| 166 | + expect(@result[:exitcode]).not_to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 167 | + expect(@result[:exitcode]).to eq(0), "Runtime error: #{@result[:logs]}" |
| 168 | + end |
| 169 | + |
| 170 | + it 'should indicate that the option was disabled' do |
| 171 | + expect(@result[:stderr]).to match(/Disabling --compare-file-text; not supported by OctocatalogDiff::Catalog::Noop/) |
| 172 | + end |
| 173 | + |
| 174 | + it 'should not have converted resources in the catalog' do |
| 175 | + catalog = OctocatalogDiff::Catalog::JSON.new(json: @result[:stdout]) |
| 176 | + resource = catalog.resource(type: 'File', title: '/tmp/foo2') |
| 177 | + expect(resource).to be_a_kind_of(Hash) |
| 178 | + expect(resource['parameters']).to eq('source' => 'puppet:///modules/test/foo-old') |
| 179 | + end |
| 180 | + end |
| 181 | + |
| 182 | + context 'with option force-enabled' do |
| 183 | + before(:all) do |
| 184 | + @result = OctocatalogDiff::Integration.integration_cli( |
| 185 | + [ |
| 186 | + '--fact-file', OctocatalogDiff::Spec.fixture_path('facts/facts.yaml'), |
| 187 | + '--catalog-only', |
| 188 | + '-n', 'rspec-node.github.net', |
| 189 | + '--compare-file-text=force', |
| 190 | + '--basedir', OctocatalogDiff::Spec.fixture_path('repos/convert-resources/new'), |
| 191 | + '--puppet-binary', OctocatalogDiff::Spec::PUPPET_BINARY, |
| 192 | + '--debug' |
| 193 | + ] |
| 194 | + ) |
| 195 | + end |
| 196 | + |
| 197 | + it 'should compile the catalog' do |
| 198 | + expect(@result[:exitcode]).not_to eq(-1), OctocatalogDiff::Integration.format_exception(@result) |
| 199 | + expect(@result[:exitcode]).to eq(0), "Runtime error: #{@result[:logs]}" |
| 200 | + end |
| 201 | + |
| 202 | + it 'should indicate that the option was force-enabled' do |
| 203 | + rexp = /--compare-file-text is force-enabled even though it is not supported by OctocatalogDiff::Catalog::Noop/ |
| 204 | + expect(@result[:stderr]).to match(rexp) |
| 205 | + end |
| 206 | + |
| 207 | + it 'should have converted resources in the catalog' do |
| 208 | + catalog = OctocatalogDiff::Catalog::JSON.new(json: @result[:stdout]) |
| 209 | + resource = catalog.resource(type: 'File', title: '/tmp/foo2') |
| 210 | + expect(resource).to be_a_kind_of(Hash) |
| 211 | + expect(resource['parameters']).to eq('content' => "content of foo-old\n") |
| 212 | + end |
| 213 | + end |
| 214 | + |
150 | 215 | context 'with broken reference in to-catalog' do |
151 | 216 | it 'should fail' do |
152 | 217 | result = OctocatalogDiff::Integration.integration( |
|
0 commit comments