Skip to content

Commit

Permalink
Added tests for interfaces and ssl_interfaces parameters
Browse files Browse the repository at this point in the history
Added spec tests for new interfaces and ssl_interfaces parameters to
ensure they are configured properly and generate the expected output.
  • Loading branch information
danielgadd committed Feb 10, 2015
1 parent a8e4ec6 commit de6fed2
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,16 @@
end
end

describe 'interfaces option with no ssl' do
let(:params) {
{ :interface => '0.0.0.0',
} }

it 'should set ssl options to specified values' do
should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\{"0.0.0.0", 5672\}\]})
end
end

describe 'ssl options' do
let(:params) {
{ :ssl => true,
Expand All @@ -484,6 +494,27 @@
end
end


describe 'ssl options with ssl_interfaces' do
let(:params) {
{ :ssl => true,
:ssl_port => 3141,
:ssl_interface => '0.0.0.0',
:ssl_cacert => '/path/to/cacert',
:ssl_cert => '/path/to/cert',
:ssl_key => '/path/to/key'
} }

it 'should set ssl options to specified values' do
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
end
end



describe 'ssl options with ssl_only' do
let(:params) {
{ :ssl => true,
Expand All @@ -503,6 +534,26 @@
end
end

describe 'ssl options with ssl_only and ssl_interfaces' do
let(:params) {
{ :ssl => true,
:ssl_only => true,
:ssl_port => 3141,
:ssl_interface => '0.0.0.0',
:ssl_cacert => '/path/to/cacert',
:ssl_cert => '/path/to/cert',
:ssl_key => '/path/to/key'
} }

it 'should set ssl options to specified values' do
should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
end
end

describe 'ssl options with specific ssl versions' do
let(:params) {
{ :ssl => true,
Expand Down

0 comments on commit de6fed2

Please sign in to comment.