Skip to content

Commit

Permalink
add test to for handling nested arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
kengelhardt-godaddy committed Apr 23, 2021
1 parent 079ed2a commit 7f8491e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/acceptance/ipset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
it { is_expected.to be_enabled }
end
end

context 'with a basic ipset' do
it 'works idempotently with no errors' do
pp = <<-EOS
Expand All @@ -32,6 +33,25 @@
end
end

context 'with a nested array' do
it 'handles nested arrays with no errors' do
pp = <<-EOS
include ipset
ipset::set{'nested-set':
set => ['10.0.0.1', ['10.0.0.2', '10.0.0.42']],
type => 'hash:net',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe command('ipset list basic-set') do
its(:stdout) { is_expected.to match %r{.*basic-set.*Type: hash:net.*10\.0\.0\.2.*}m }
end
end

context 'can delete ipsets' do
it 'works even here idempotently with no errors' do
pp = <<-EOS
Expand Down

0 comments on commit 7f8491e

Please sign in to comment.