Skip to content

Commit

Permalink
Add specs for physical_volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Elbandi committed Nov 18, 2024
1 parent bcfdff7 commit a16b51f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/unit/type/logical_volume_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,19 @@
}.not_to raise_error
end

it 'raises an ArgumentError when the physical volume is neither string nor array' do

Check failure on line 188 in spec/unit/type/logical_volume_spec.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 7.24, Ruby Ver: 2.7)

Puppet::Type::Logical_volume raises an ArgumentError when the physical volume is neither string nor array Failure/Error: expect { resource = Puppet::Type.type(:logical_volume).new( name: 'john', ensure: :present, volume_group: 'ernie', size: '10M', physical_volume: 42, ) }.to raise_error(Puppet::ResourceError, 'physical_volume should be String or Array: 42') expected Puppet::ResourceError with "physical_volume should be String or Array: 42", got #<Puppet::ResourceError: Parameter physical_volume failed on Logical_volume[john]: physical_volume should be String or Array: 42> with backtrace: # ./lib/puppet/type/logical_volume.rb:126:in `block (3 levels) in <top (required)>' # ./spec/unit/type/logical_volume_spec.rb:190:in `new' # ./spec/unit/type/logical_volume_spec.rb:190:in `block (3 levels) in <top (required)>' # ./spec/unit/type/logical_volume_spec.rb:189:in `block (2 levels) in <top (required)>' # ./vendor/bundle/ruby/2.7.0/bin/rspec:23:in `load' # ./vendor/bundle/ruby/2.7.0/bin/rspec:23:in `<top (required)>' # /opt/hostedtoolcache/Ruby/2.7.8/x64/bin/bundle:23:in `load' # /opt/hostedtoolcache/Ruby/2.7.8/x64/bin/bundle:23:in `<main>'

Check failure on line 188 in spec/unit/type/logical_volume_spec.rb

View workflow job for this annotation

GitHub Actions / Spec / Spec tests (Puppet: ~> 8.0, Ruby Ver: 3.2)

Puppet::Type::Logical_volume raises an ArgumentError when the physical volume is neither string nor array Failure/Error: expect { resource = Puppet::Type.type(:logical_volume).new( name: 'john', ensure: :present, volume_group: 'ernie', size: '10M', physical_volume: 42, ) }.to raise_error(Puppet::ResourceError, 'physical_volume should be String or Array: 42') expected Puppet::ResourceError with "physical_volume should be String or Array: 42", got #<Puppet::ResourceError: Parameter physical_volume failed on Logical_volume[john]: physical_volume should be String or Array: 42> with backtrace: # ./lib/puppet/type/logical_volume.rb:126:in `block (3 levels) in <top (required)>' # ./spec/unit/type/logical_volume_spec.rb:190:in `new' # ./spec/unit/type/logical_volume_spec.rb:190:in `block (3 levels) in <top (required)>' # ./spec/unit/type/logical_volume_spec.rb:189:in `block (2 levels) in <top (required)>' # ./vendor/bundle/ruby/3.2.0/bin/rspec:25:in `load' # ./vendor/bundle/ruby/3.2.0/bin/rspec:25:in `<top (required)>' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `load' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/cli/exec.rb:58:in `kernel_load' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/cli/exec.rb:23:in `run' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/cli.rb:492:in `exec' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/cli.rb:34:in `dispatch' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/cli.rb:28:in `start' # /opt/hostedtoolcache/Ruby/3.2.6/x64/lib/ruby/3.2.0/bundler/friendly_errors.rb:117:in `with_friendly_errors' # /opt/hostedtoolcache/Ruby/3.2.6/x64/bin/bundle:25:in `load' # /opt/hostedtoolcache/Ruby/3.2.6/x64/bin/bundle:25:in `<main>'
expect {
resource = Puppet::Type.type(:logical_volume).new(
name: 'john',
ensure: :present,
volume_group: 'ernie',
size: '10M',
physical_volume: 42,
)
}.to raise_error(Puppet::ResourceError,
'physical_volume should be String or Array: 42')
end

it 'invalid number of stripes raises error' do
expect {
resource = Puppet::Type.type(:logical_volume).new(
Expand Down

0 comments on commit a16b51f

Please sign in to comment.