|
138 | 138 | end
|
139 | 139 |
|
140 | 140 | describe "when exclude_unchanged_resources is true" do
|
| 141 | + let(:test_dir) { tmpdir('unchanged_resources') } |
| 142 | + let(:test_dir2) { tmpdir('unchanged_resources') } |
| 143 | + let(:test_file) { tmpfile('some_path')} |
| 144 | + it 'should still list "changed" resource statuses but remove "unchanged"' do |
| 145 | + transaction = apply_compiled_manifest(<<-END) |
| 146 | + notify { "hi": } ~> |
| 147 | + exec { "/bin/this_command_does_not_exist": |
| 148 | + command => "#{make_absolute('/bin/this_command_does_not_exist')}", |
| 149 | + refreshonly => true, |
| 150 | + } |
| 151 | + file { '#{test_dir}': |
| 152 | + ensure => directory |
| 153 | + } |
| 154 | + file { 'failing_file': |
| 155 | + path => '#{test_dir2}', |
| 156 | + ensure => file |
| 157 | + } |
| 158 | + file { 'skipped_file': |
| 159 | + path => '#{test_file}', |
| 160 | + require => File[failing_file] |
| 161 | + } |
| 162 | + END |
| 163 | + rs = transaction.report.to_data_hash['resource_statuses'] |
| 164 | + expect(rs["Notify[hi]"]['out_of_sync']).to be true |
| 165 | + expect(rs["Exec[/bin/this_command_does_not_exist]"]['failed_to_restart']).to be true |
| 166 | + expect(rs["File[failing_file]"]['failed']).to be true |
| 167 | + expect(rs["File[skipped_file]"]['skipped']).to be true |
| 168 | + expect(rs).to_not have_key(["File[#{test_dir}]"]) |
| 169 | + end |
| 170 | + end |
| 171 | + |
| 172 | + describe"when exclude_unchanged_resources is false" do |
141 | 173 | before do
|
142 |
| - Puppet[:exclude_unchanged_resources] = true |
| 174 | + Puppet[:exclude_unchanged_resources] = false |
143 | 175 | end
|
144 | 176 |
|
145 | 177 | let(:test_dir) { tmpdir('unchanged_resources') }
|
146 | 178 | let(:test_dir2) { tmpdir('unchanged_resources') }
|
147 | 179 | let(:test_file) { tmpfile('some_path')}
|
148 |
| - it 'should still list "changed" resource statuses but remove "unchanged"' do |
| 180 | + it 'should list all resource statuses' do |
149 | 181 | transaction = apply_compiled_manifest(<<-END)
|
150 | 182 | notify { "hi": } ~>
|
151 | 183 | exec { "/bin/this_command_does_not_exist":
|
|
169 | 201 | expect(rs["Exec[/bin/this_command_does_not_exist]"]['failed_to_restart']).to be true
|
170 | 202 | expect(rs["File[failing_file]"]['failed']).to be true
|
171 | 203 | expect(rs["File[skipped_file]"]['skipped']).to be true
|
172 |
| - expect(rs).to_not have_key(["File[#{test_dir}]"]) |
| 204 | + expect(rs["File[#{test_dir}]"]['changed']).to be false |
173 | 205 | end
|
174 | 206 | end
|
175 | 207 |
|
|
0 commit comments