Skip to content

Commit ae66ee8

Browse files
committed
Updating rspec tests for ssl_version changes, whitespace and rabbitmq_management version block
1 parent 4dcfdf5 commit ae66ee8

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

spec/classes/rabbitmq_spec.rb

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@
519519
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
520520
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
521521
should contain_file('rabbitmq.config').with_content(%r{ssl, \[\{versions, \['tlsv1.1', 'tlsv1.2'\]\}\]})
522+
should contain_file('rabbitmq.config').with_content(%r{versions, \['tlsv1.1', 'tlsv1.2'\]})
522523
end
523524
end
524525

@@ -552,6 +553,29 @@
552553
end
553554
end
554555

556+
describe 'ssl admin options with specific ssl versions' do
557+
let(:params) {
558+
{ :ssl => true,
559+
:ssl_management_port => 5926,
560+
:ssl_cacert => '/path/to/cacert',
561+
:ssl_cert => '/path/to/cert',
562+
:ssl_key => '/path/to/key',
563+
:ssl_versions => ['tlsv1.2', 'tlsv1.1'],
564+
:admin_enable => true
565+
} }
566+
567+
it 'should set admin ssl opts to specified values' do
568+
should contain_file('rabbitmq.config').with_content(%r{rabbitmq_management, \[})
569+
should contain_file('rabbitmq.config').with_content(%r{listener, \[})
570+
should contain_file('rabbitmq.config').with_content(%r{port, 5926\}})
571+
should contain_file('rabbitmq.config').with_content(%r{ssl, true\}})
572+
should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{cacertfile, "/path/to/cacert"\},})
573+
should contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
574+
should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}})
575+
should contain_file('rabbitmq.config').with_content(%r{,\{versions, \['tlsv1.1', 'tlsv1.2'\]\}[\r\n ]*\]\}})
576+
end
577+
end
578+
555579
describe 'ssl admin options' do
556580
let(:params) {
557581
{ :ssl => true,
@@ -569,7 +593,7 @@
569593
should contain_file('rabbitmq.config').with_content(%r{ssl, true\}})
570594
should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{cacertfile, "/path/to/cacert"\},})
571595
should contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
572-
should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}\]\}})
596+
should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}[\r\n ]*\]\}})
573597
end
574598
end
575599

@@ -604,7 +628,7 @@
604628
should contain_file('rabbitmq.config').with_content(%r{ssl, true\},})
605629
should contain_file('rabbitmq.config').with_content(%r{ssl_opts, \[\{cacertfile, "/path/to/cacert"\},})
606630
should contain_file('rabbitmq.config').with_content(%r{certfile, "/path/to/cert"\},})
607-
should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}\]\}})
631+
should contain_file('rabbitmq.config').with_content(%r{keyfile, "/path/to/key"\}[\r\n ]*\]\}})
608632
end
609633
end
610634

0 commit comments

Comments
 (0)