|
228 | 228 |
|
229 | 229 | describe 'when destroying' do |
230 | 230 | it "should execute 'dmsetup' and 'lvremove'" do |
231 | | - @resource.expects(:[]).with(:volume_group).returns('myvg').twice |
232 | | - @resource.expects(:[]).with(:name).returns('mylv').twice |
| 231 | + @resource.expects(:[]).with(:volume_group).returns('myvg').times(3) |
| 232 | + @resource.expects(:[]).with(:name).returns('mylv').times(3) |
| 233 | + @provider.expects(:blkid).with('/dev/myvg/mylv') |
233 | 234 | @provider.expects(:dmsetup).with('remove', 'myvg-mylv') |
234 | 235 | @provider.expects(:lvremove).with('-f', '/dev/myvg/mylv') |
235 | 236 | @provider.destroy |
236 | 237 | end |
237 | 238 | it "should execute 'dmsetup' and 'lvremove' and properly escape names with dashes" do |
238 | | - @resource.expects(:[]).with(:volume_group).returns('my-vg').twice |
239 | | - @resource.expects(:[]).with(:name).returns('my-lv').twice |
| 239 | + @resource.expects(:[]).with(:volume_group).returns('my-vg').times(3) |
| 240 | + @resource.expects(:[]).with(:name).returns('my-lv').times(3) |
| 241 | + @provider.expects(:blkid).with('/dev/my-vg/my-lv') |
240 | 242 | @provider.expects(:dmsetup).with('remove', 'my--vg-my--lv') |
241 | 243 | @provider.expects(:lvremove).with('-f', '/dev/my-vg/my-lv') |
242 | 244 | @provider.destroy |
243 | 245 | end |
| 246 | + it "should execute 'swapoff', 'dmsetup', and 'lvremove' when lvm is of type swap" do |
| 247 | + @resource.expects(:[]).with(:volume_group).returns('myvg').times(4) |
| 248 | + @resource.expects(:[]).with(:name).returns('mylv').times(4) |
| 249 | + @provider.expects(:blkid).with('/dev/myvg/mylv').returns('TYPE="swap"') |
| 250 | + @provider.expects(:swapoff).with('/dev/myvg/mylv') |
| 251 | + @provider.expects(:dmsetup).with('remove', 'myvg-mylv') |
| 252 | + @provider.expects(:lvremove).with('-f', '/dev/myvg/mylv') |
| 253 | + @provider.destroy |
| 254 | + end |
244 | 255 | end |
245 | 256 | end |
0 commit comments