File tree Expand file tree Collapse file tree 2 files changed +51
-1
lines changed
Expand file tree Collapse file tree 2 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 1212 if $consul::manage_service == true and $consul::service_ensure == ' running' {
1313 exec { 'reload consul service' :
1414 path => [$consul::bin_dir ,' /bin' ,' /usr/bin' ],
15- command => ' consul reload' ,
15+ command => " consul reload -rpc-addr= ${consul::rpc_addr} : ${consul::rpc_port} " ,
1616 refreshonly => true ,
1717 }
1818 }
Original file line number Diff line number Diff line change 342342 it { should contain_file ( '/etc/init/consul.conf' ) . with_content ( /env GROUP=custom_consul_group/ ) }
343343 end
344344
345+ context "When consul is reloaded" do
346+ let ( :params ) { {
347+ :services => {
348+ 'test_service1' => { }
349+ }
350+ } }
351+ let ( :facts ) { {
352+ :ipaddress_lo => '127.0.0.1'
353+ } }
354+ it {
355+ should contain_exec ( 'reload consul service' ) .
356+ with_command ( 'consul reload -rpc-addr=127.0.0.1:8400' )
357+ }
358+ end
359+
360+ context "When consul is reloaded on a custom port" do
361+ let ( :params ) { {
362+ :services => {
363+ 'test_service1' => { }
364+ } ,
365+ :config_hash => {
366+ 'ports' => {
367+ 'rpc' => '9999'
368+ } ,
369+ 'addresses' => {
370+ 'rpc' => 'consul.example.com'
371+ }
372+ }
373+ } }
374+ it {
375+ should contain_exec ( 'reload consul service' ) .
376+ with_command ( 'consul reload -rpc-addr=consul.example.com:9999' )
377+ }
378+ end
379+
380+ context "When consul is reloaded with a default client_addr" do
381+ let ( :params ) { {
382+ :services => {
383+ 'test_service1' => { }
384+ } ,
385+ :config_hash => {
386+ 'client_addr' => '192.168.34.56' ,
387+ }
388+ } }
389+ it {
390+ should contain_exec ( 'reload consul service' ) .
391+ with_command ( 'consul reload -rpc-addr=192.168.34.56:8400' )
392+ }
393+ end
394+
345395 context "When the user provides a hash of services" do
346396 let ( :params ) { {
347397 :services => {
You can’t perform that action at this time.
0 commit comments