Skip to content

Commit

Permalink
Updating spec tests for chef sysctl resource
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Sidorenko <[email protected]>
  • Loading branch information
artem-sidorenko committed Mar 11, 2019
1 parent c36c0cf commit 5220c3b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions spec/recipes/sysctl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
let(:network_forwarding) { true }

it 'should enable IPv4 forwarding in sysctl attributes' do
expect(chef_run).to apply_sysctl_param('net.ipv4.ip_forward').with(
expect(chef_run).to apply_sysctl('net.ipv4.ip_forward').with(
value: '1'
)
end
Expand All @@ -168,7 +168,7 @@
let(:network_forwarding) { false }

it 'should disable IPv4 forwarding in sysctl attributes' do
expect(chef_run).to apply_sysctl_param('net.ipv4.ip_forward').with(
expect(chef_run).to apply_sysctl('net.ipv4.ip_forward').with(
value: '0'
)
end
Expand All @@ -178,7 +178,7 @@
describe 'IPv6 forwarding' do
RSpec.shared_examples 'IPv6 forwarding in sysctl attributes' do |state|
it "should #{state == 1 ? 'enable' : 'disable'} IPv6 forwarding in sysctl attributes" do # rubocop:disable Metrics/LineLength
expect(chef_run).to apply_sysctl_param('net.ipv6.conf.all.forwarding').with(
expect(chef_run).to apply_sysctl('net.ipv6.conf.all.forwarding').with(
value: state.to_s
)
end
Expand Down Expand Up @@ -221,7 +221,7 @@
let(:ipv6_enable) { true }

it 'should not disable IPv6' do
expect(chef_run).to apply_sysctl_param('net.ipv4.ip_forward').with(
expect(chef_run).to apply_sysctl('net.ipv4.ip_forward').with(
value: '0'
)
end
Expand All @@ -231,7 +231,7 @@
let(:ipv6_enable) { false }

it 'should not disable IPv6' do
expect(chef_run).to apply_sysctl_param('net.ipv6.conf.all.forwarding').with(
expect(chef_run).to apply_sysctl('net.ipv6.conf.all.forwarding').with(
value: '0'
)
end
Expand All @@ -242,15 +242,15 @@
RSpec.shared_examples 'ARP restrictions in sysctl attributes' do |arp_ignore, arp_announce| # rubocop:disable Metrics/LineLength
describe 'arp_ignore' do
it "should be set to #{arp_ignore}" do
expect(chef_run).to apply_sysctl_param('net.ipv4.conf.all.arp_ignore').with(
expect(chef_run).to apply_sysctl('net.ipv4.conf.all.arp_ignore').with(
value: arp_ignore.to_s
)
end
end

describe 'arp_announce' do
it "should be set to #{arp_announce}" do
expect(chef_run).to apply_sysctl_param('net.ipv4.conf.all.arp_announce').with(
expect(chef_run).to apply_sysctl('net.ipv4.conf.all.arp_announce').with(
value: arp_announce.to_s
)
end
Expand All @@ -275,7 +275,7 @@
let(:enable_module_loading) { true }

it 'should not set the sysctl flag' do
expect(chef_run).to_not apply_sysctl_param('kernel.modules_disabled')
expect(chef_run).to_not apply_sysctl('kernel.modules_disabled')
end

describe 'rebuild of initramfs' do
Expand All @@ -295,7 +295,7 @@
let(:enable_module_loading) { false }

it 'should disable module loading via sysctl flag' do
expect(chef_run).to apply_sysctl_param('kernel.modules_disabled').with(
expect(chef_run).to apply_sysctl('kernel.modules_disabled').with(
value: '1'
)
end
Expand All @@ -319,7 +319,7 @@
let(:enable_sysrq) { true }

it 'should enable sysrq with safe value' do
expect(chef_run).to apply_sysctl_param('kernel.sysrq').with(
expect(chef_run).to apply_sysctl('kernel.sysrq').with(
value: '244'
)
end
Expand All @@ -329,7 +329,7 @@
let(:enable_sysrq) { false }

it 'should disable sysrq' do
expect(chef_run).to apply_sysctl_param('kernel.sysrq').with(
expect(chef_run).to apply_sysctl('kernel.sysrq').with(
value: '0'
)
end
Expand All @@ -341,7 +341,7 @@
let(:enable_core_dump) { true }

it 'should set suid_dumpable to safe value' do
expect(chef_run).to apply_sysctl_param('fs.suid_dumpable').with(
expect(chef_run).to apply_sysctl('fs.suid_dumpable').with(
value: '2'
)
end
Expand All @@ -351,7 +351,7 @@
let(:enable_core_dump) { false }

it 'should set suid_dumpable to default value' do
expect(chef_run).to apply_sysctl_param('fs.suid_dumpable').with(
expect(chef_run).to apply_sysctl('fs.suid_dumpable').with(
value: '0'
)
end
Expand Down

0 comments on commit 5220c3b

Please sign in to comment.