|
142 | 142 | expect(@result.stderr).to match(/Diffs computed for rspec-node.github.net/)
|
143 | 143 | end
|
144 | 144 | end
|
| 145 | + |
| 146 | +describe 'fact file from the configuration' do |
| 147 | + before(:all) do |
| 148 | + ENV['PUPPET_FACT_FILE_DIR'] = OctocatalogDiff::Spec.fixture_path('facts') |
| 149 | + @result = OctocatalogDiff::Integration.integration_cli( |
| 150 | + [ |
| 151 | + '-n', 'rspec-node.github.net', |
| 152 | + '--bootstrapped-to-dir', OctocatalogDiff::Spec.fixture_path('repos/fact-overrides'), |
| 153 | + '--catalog-only', |
| 154 | + '--puppet-binary', OctocatalogDiff::Spec::PUPPET_BINARY, |
| 155 | + '-d' |
| 156 | + ], |
| 157 | + OctocatalogDiff::Spec.fixture_path('cli-configs/fact-file.rb') |
| 158 | + ) |
| 159 | + end |
| 160 | + |
| 161 | + after(:all) do |
| 162 | + ENV.delete('PUPPET_FACT_FILE_DIR') |
| 163 | + end |
| 164 | + |
| 165 | + it 'should exit with status 0' do |
| 166 | + expect(@result.exitcode).to eq(0), @result.stderr |
| 167 | + end |
| 168 | + |
| 169 | + it 'should contain resources generated from the proper fact file' do |
| 170 | + expect(@result.stdout).to match(/"10.20.30.40"/) |
| 171 | + end |
| 172 | +end |
| 173 | + |
| 174 | +describe 'fact file overridden on the command line' do |
| 175 | + before(:all) do |
| 176 | + ENV['PUPPET_FACT_FILE_DIR'] = OctocatalogDiff::Spec.fixture_path('facts') |
| 177 | + @result = OctocatalogDiff::Integration.integration_cli( |
| 178 | + [ |
| 179 | + '-n', 'rspec-node.github.net', |
| 180 | + '--bootstrapped-to-dir', OctocatalogDiff::Spec.fixture_path('repos/fact-overrides'), |
| 181 | + '--catalog-only', |
| 182 | + '--puppet-binary', OctocatalogDiff::Spec::PUPPET_BINARY, |
| 183 | + '-d', |
| 184 | + '--fact-file', OctocatalogDiff::Spec.fixture_path('facts/valid-facts-different-ip.yaml') |
| 185 | + ], |
| 186 | + OctocatalogDiff::Spec.fixture_path('cli-configs/fact-file.rb') |
| 187 | + ) |
| 188 | + end |
| 189 | + |
| 190 | + after(:all) do |
| 191 | + ENV.delete('PUPPET_FACT_FILE_DIR') |
| 192 | + end |
| 193 | + |
| 194 | + it 'should exit with status 0' do |
| 195 | + expect(@result.exitcode).to eq(0), @result.stderr |
| 196 | + end |
| 197 | + |
| 198 | + it 'should contain resources generated from the proper fact file' do |
| 199 | + expect(@result.stdout).to match(/"10.30.50.70"/) |
| 200 | + end |
| 201 | +end |
0 commit comments