Skip to content

Commit

Permalink
Add relevant tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glangloi committed Apr 8, 2024
1 parent e1c93fd commit 04576a1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
23 changes: 18 additions & 5 deletions spec/unit/puppet/provider/volume_group/lvm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,24 @@
end

describe 'when creating' do
it "executes 'vgcreate'" do
@resource.expects(:[]).with(:name).returns('myvg')
@resource.expects(:should).with(:physical_volumes).returns(['/dev/hda'])
@provider.expects(:vgcreate).with('myvg', '/dev/hda')
@provider.create
context 'when an extent size is not provided' do
it "executes 'vgcreate'" do
@resource.expects(:[]).with(:name).returns('myvg')
@resource.expects(:[]).with(:extent_size).returns(nil)
@resource.expects(:should).with(:physical_volumes).returns(['/dev/hda'])
@provider.expects(:vgcreate).with('myvg', '/dev/hda')
@provider.create
end
end

context 'when an extent size is provided' do
it "executes 'vgcreate' with the desired extent size" do
@resource.expects(:[]).with(:name).returns('myvg')
@resource.expects(:[]).twice.with(:extent_size).returns('16M')
@resource.expects(:should).with(:physical_volumes).returns(['/dev/hda'])
@provider.expects(:vgcreate).with('myvg', '/dev/hda', '-s', '16M')
@provider.create
end
end
end

Expand Down
6 changes: 6 additions & 0 deletions spec/unit/puppet/type/volume_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
end
end

describe 'the extent_size parameter' do
it 'exists' do
@type.attrclass(:extent_size).should_not be_nil
end
end

describe "the 'ensure' parameter" do
it 'exists' do
@type.attrclass(:ensure).should_not be_nil
Expand Down

0 comments on commit 04576a1

Please sign in to comment.