From ae66ee8307f1e563bc22c79949b527939c4aa0f0 Mon Sep 17 00:00:00 2001 From: Dale Smith Date: Thu, 29 Jan 2015 18:17:09 +0000 Subject: [PATCH] Updating rspec tests for ssl_version changes, whitespace and rabbitmq_management version block --- spec/classes/rabbitmq_spec.rb | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/spec/classes/rabbitmq_spec.rb b/spec/classes/rabbitmq_spec.rb index 1d6e5946a..8429c98c4 100644 --- a/spec/classes/rabbitmq_spec.rb +++ b/spec/classes/rabbitmq_spec.rb @@ -519,6 +519,7 @@ should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"}) should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key}) should contain_file('rabbitmq.config').with_content(%r{ssl, \[\{versions, \['tlsv1.1', 'tlsv1.2'\]\}\]}) + should contain_file('rabbitmq.config').with_content(%r{versions, \['tlsv1.1', 'tlsv1.2'\]}) end end @@ -552,6 +553,29 @@ end end + describe 'ssl admin options with specific ssl versions' do + let(:params) { + { :ssl => true, + :ssl_management_port => 5926, + :ssl_cacert => '/path/to/cacert', + :ssl_cert => '/path/to/cert', + :ssl_key => '/path/to/key', + :ssl_versions => ['tlsv1.2', 'tlsv1.1'], + :admin_enable => true + } } + + it 'should set admin ssl opts to specified values' do + should contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[}) + should contain_file('rabbitmq.config').with_content(%r{listener, \[}) + should contain_file('rabbitmq.config').with_content(%r{port, 5926\}}) + should contain_file('rabbitmq.config').with_content(%r{ssl, true\}}) + should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{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"\}}) + should contain_file('rabbitmq.config').with_content(%r{,\{versions, \['tlsv1.1', 'tlsv1.2'\]\}[\r\n ]*\]\}}) + end + end + describe 'ssl admin options' do let(:params) { { :ssl => true, @@ -569,7 +593,7 @@ should contain_file('rabbitmq.config').with_content(%r{ssl, true\}}) should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{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"\}\]\}}) + should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}[\r\n ]*\]\}}) end end @@ -604,7 +628,7 @@ should contain_file('rabbitmq.config').with_content(%r{ssl, true\},}) should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{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"\}\]\}}) + should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}[\r\n ]*\]\}}) end end