aboutsummaryrefslogtreecommitdiffstats
path: root/spec/unit/provider
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/provider')
-rw-r--r--spec/unit/provider/vpp_config/vpp_spec.rb37
-rw-r--r--spec/unit/provider/vpp_service/vpp_spec.rb44
2 files changed, 37 insertions, 44 deletions
diff --git a/spec/unit/provider/vpp_config/vpp_spec.rb b/spec/unit/provider/vpp_config/vpp_spec.rb
new file mode 100644
index 0000000..913d795
--- /dev/null
+++ b/spec/unit/provider/vpp_config/vpp_spec.rb
@@ -0,0 +1,37 @@
+require 'puppet'
+require 'puppet/provider/vpp_config/vpp'
+require 'spec_helper'
+
+provider_class = Puppet::Type.type(:vpp_config).provider(:vpp)
+
+describe 'Puppet::Type.type(:vpp_config).provider(:vpp)' do
+
+ let :vpp_attrs do
+ {
+ :setting => 'dpdk/dev/0000:00:07.0',
+ :ensure => 'present',
+ }
+ end
+
+ let :resource do
+ Puppet::Type::Vpp_config.new(vpp_attrs)
+ end
+
+ let :provider do
+ provider_class.new(resource)
+ end
+
+ describe 'on create' do
+ it 'should call add_setting' do
+ provider.expects(:add_setting)
+ provider.create
+ end
+ end
+
+ describe "when changing value" do
+ it 'should change value' do
+ provider.expects(:add_setting).with('vlan-strip-offload on')
+ provider.value = 'vlan-strip-offload on'
+ end
+ end
+end \ No newline at end of file
diff --git a/spec/unit/provider/vpp_service/vpp_spec.rb b/spec/unit/provider/vpp_service/vpp_spec.rb
deleted file mode 100644
index f75f80c..0000000
--- a/spec/unit/provider/vpp_service/vpp_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-require 'puppet'
-require 'puppet/provider/vpp_service/vpp'
-require 'spec_helper'
-
-provider_class = Puppet::Type.type(:vpp_service).provider(:vpp)
-
-describe 'Puppet::Type.type(:vpp_service).provider(:vpp)' do
-
- let :vpp_attrs do
- {
- :name => 'vpp service config',
- :pci_devs => '0000:00:07.0',
- :ensure => 'present',
- :state => 'up',
- :copy_kernel_nic_ip => 'false',
- }
- end
-
- let :resource do
- Puppet::Type::Vpp_service.new(vpp_attrs)
- end
-
- let :provider do
- provider_class.new(resource)
- end
-
- describe 'on create' do
- it 'should call service restart' do
- provider.expects(:vpp_pre_config)
- provider.expects(:configure_vpp_interfaces)
- provider.expects(:systemctlcmd).with('restart', 'vpp')
- provider.expects(:systemctlcmd).with('enable', 'vpp')
- provider.create
- end
- end
-
- describe "when changing state" do
- it 'should change state' do
- provider.stubs(:get_int_prefix).returns('GigabitEthernet0/7/0')
- provider.expects(:vppctlcmd).with('set int state', 'GigabitEthernet0/7/0', 'down')
- provider.state = 'down'
- end
- end
-end \ No newline at end of file