Skip to content

Commit d64c11d

Browse files
committed
Add a test for #230
Test that exists returns nil if the name of the logical volume is a substring of the name of an existing logical volume.
1 parent 8d69afa commit d64c11d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/unit/puppet/provider/logical_volume/lvm_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
@provider.class.stubs(:lvs).with('data').returns(lvs_output)
3535
expect(@provider.exists?).to be > 10
3636
end
37+
it "returns 'nil', lv 'swap' in vg 'VolGroup' exists" do
38+
@resource.expects(:[]).with(:name).returns('swap')
39+
@resource.expects(:[]).with(:volume_group).returns('VolGroup').at_least_once
40+
@provider.class.stubs(:lvs).with('VolGroup').returns(lvs_output)
41+
expect(@provider.exists?).to be_nil
42+
end
3743
it "returns 'nil', lv 'data' in vg 'myvg' does not exist" do
3844
@resource.expects(:[]).with(:volume_group).returns('myvg').at_least_once
3945
@provider.class.stubs(:lvs).with('myvg').raises(Puppet::ExecutionFailure, 'Execution of \'/sbin/lvs myvg\' returned 5')

0 commit comments

Comments
 (0)