|
20 | 20 | ensure => present, |
21 | 21 | content => 'a wild test file has appeared!', |
22 | 22 | } |
| 23 | + file { '#{test_file}.does_not_exist': |
| 24 | + ensure => absent, |
| 25 | + } |
23 | 26 | MANIFEST |
24 | 27 | apply_manifest(pp_test_file) |
25 | 28 | end |
|
97 | 100 | end |
98 | 101 | end |
99 | 102 | end |
| 103 | + |
| 104 | + context 'when file does not exist' do |
| 105 | + context 'with ensure => present' do |
| 106 | + let(:pp) do |
| 107 | + <<~MANIFEST |
| 108 | + file_line { 'test_absent_file': |
| 109 | + ensure => present, |
| 110 | + path => '#{test_file}.does_not_exist', |
| 111 | + line => 'this file does not exist', |
| 112 | + } |
| 113 | + MANIFEST |
| 114 | + end |
| 115 | + |
| 116 | + it 'fails to apply manifest' do |
| 117 | + apply_manifest(pp, expect_failures: true) |
| 118 | + end |
| 119 | + end |
| 120 | + |
| 121 | + context 'with ensure => present and noop => true' do |
| 122 | + let(:pp) do |
| 123 | + <<~MANIFEST |
| 124 | + file_line { 'test_absent_file': |
| 125 | + ensure => present, |
| 126 | + path => '#{test_file}.does_not_exist', |
| 127 | + line => 'this file does not exist', |
| 128 | + noop => true, |
| 129 | + } |
| 130 | + MANIFEST |
| 131 | + end |
| 132 | + |
| 133 | + it 'would apply manifest' do |
| 134 | + apply_manifest(pp, catch_failures: true) |
| 135 | + end |
| 136 | + end |
| 137 | + |
| 138 | + context 'with ensure => present, in noop mode' do |
| 139 | + let(:pp) do |
| 140 | + <<~MANIFEST |
| 141 | + file_line { 'test_absent_file': |
| 142 | + ensure => present, |
| 143 | + path => '#{test_file}.does_not_exist', |
| 144 | + line => 'this file does not exist', |
| 145 | + } |
| 146 | + MANIFEST |
| 147 | + end |
| 148 | + |
| 149 | + it 'would apply manifest' do |
| 150 | + apply_manifest(pp, catch_failures: true, noop: true) |
| 151 | + end |
| 152 | + end |
| 153 | + end |
100 | 154 | end |
0 commit comments