diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-08-29 23:29:27 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-08-29 23:29:27 +0000 |
commit | 1047dba66ea9cadb4bc702eae5c0bc362bbc4ccc (patch) | |
tree | dff81d55c7f89dac4c619d4a56cd4491facea0d8 /spec/unit/type/sriov_vf_config_spec.rb | |
parent | d3491b5351183a16d2637c3e10afa5e66ee316ab (diff) | |
parent | eec3bba44b5a7e09dba4d427bd0d3d71a4956a7a (diff) |
Merge "Configure the numvfs for SRIOV interfaces"
Diffstat (limited to 'spec/unit/type/sriov_vf_config_spec.rb')
-rw-r--r-- | spec/unit/type/sriov_vf_config_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/unit/type/sriov_vf_config_spec.rb b/spec/unit/type/sriov_vf_config_spec.rb new file mode 100644 index 0000000..9a911f6 --- /dev/null +++ b/spec/unit/type/sriov_vf_config_spec.rb @@ -0,0 +1,47 @@ +require 'puppet' +require 'puppet/type/sriov_vf_config' + +describe 'Puppet::Type.type(:sriov_vf_config)' do + it 'should allow name to be passed' do + expect{Puppet::Type.type(:sriov_vf_config).new( + :name => 'eth0:10', + :ensure => 'present' + )}.not_to raise_error + end + it 'should allow name to be passed with -' do + expect{Puppet::Type.type(:sriov_vf_config).new( + :name => 'eth-0:10', + :ensure => 'present' + )}.not_to raise_error + end + it 'should allow name to be passed with _' do + expect{Puppet::Type.type(:sriov_vf_config).new( + :name => 'eth_0:10', + :ensure => 'present' + )}.not_to raise_error + end + it 'should throw error for invalid format' do + expect{Puppet::Type.type(:sriov_vf_config).new( + :name => 'eth0', + :ensure => 'present' + )}.to raise_error(Puppet::ResourceError) + end + it 'should throw error for invalid format without interface name' do + expect{Puppet::Type.type(:sriov_vf_config).new( + :name => ':9', + :ensure => 'present' + )}.to raise_error(Puppet::ResourceError) + end + it 'should throw error for invalid format for numvfs' do + expect{Puppet::Type.type(:sriov_vf_config).new( + :name => 'eth8:none', + :ensure => 'present' + )}.to raise_error(Puppet::ResourceError) + end + it 'should throw error for invalid format without numvfs' do + expect{Puppet::Type.type(:sriov_vf_config).new( + :name => 'eth0:', + :ensure => 'present' + )}.to raise_error(Puppet::ResourceError) + end +end |