File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
files/gitlab-cookbooks/gitlab/libraries
spec/chef/cookbooks/redis/recipes Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ def parse_redis_settings
3030 # The user wants Redis to listen via TCP instead of unix socket.
3131 Gitlab [ 'redis' ] [ 'unixsocket' ] = false
3232
33+ parse_redis_bind_address
3334 # Try to discover gitlab_rails redis connection params
3435 # based on redis daemon
3536 parse_redis_daemon! unless RedisHelper ::Checks . has_sentinels?
@@ -74,12 +75,17 @@ def redis_managed?
7475
7576 private
7677
77- def parse_redis_daemon!
78+ def parse_redis_bind_address
7879 return unless redis_managed?
7980
8081 redis_bind = Gitlab [ 'redis' ] [ 'bind' ] || node [ 'redis' ] [ 'bind' ]
8182 Gitlab [ 'redis' ] [ 'default_host' ] = redis_bind . split ( ' ' ) . first
83+ end
84+
85+ def parse_redis_daemon!
86+ return unless redis_managed?
8287
88+ redis_bind = Gitlab [ 'redis' ] [ 'bind' ] || node [ 'redis' ] [ 'bind' ]
8389 Gitlab [ 'gitlab_rails' ] [ 'redis_host' ] ||= Gitlab [ 'redis' ] [ 'default_host' ]
8490
8591 redis_port_config_key = if Gitlab [ 'redis' ] . key? ( 'port' ) && !Gitlab [ 'redis' ] [ 'port' ] . zero?
Original file line number Diff line number Diff line change 332332 expect ( chef_run ) . to render_file ( '/opt/gitlab/etc/gitlab-redis-cli-rc' )
333333 . with_content ( gitlab_redis_cli_rc )
334334 end
335+
336+ context 'with Sentinels configured' do
337+ before do
338+ stub_gitlab_rb (
339+ redis : {
340+ bind : redis_host ,
341+ port : redis_port ,
342+ ha : true ,
343+ master_ip : master_ip ,
344+ master_port : master_port ,
345+ master_password : 'password' ,
346+ master : false
347+ } ,
348+ gitlab_rails : {
349+ redis_sentinels : [
350+ { 'host' => '127.0.0.1' , 'port' => 2637 }
351+ ]
352+ }
353+ )
354+ end
355+
356+ it_behaves_like 'started down runit service' , 'redis'
357+
358+ it 'creates gitlab-redis-cli-rc' do
359+ expect ( chef_run ) . to render_file ( '/opt/gitlab/etc/gitlab-redis-cli-rc' )
360+ . with_content ( gitlab_redis_cli_rc )
361+ end
362+ end
335363 end
336364
337365 context 'with rename_commands disabled' do
You can’t perform that action at this time.
0 commit comments