Commit 27fe2ea5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'redis-sockets' into 'master'

Connect to Redis via sockets by default

See merge request !41
parents 4f3f3bee 17dab64a
...@@ -4,6 +4,7 @@ v2.0.0 ...@@ -4,6 +4,7 @@ v2.0.0
- Handle invalid number of arguments on remote commands - Handle invalid number of arguments on remote commands
- Replace update hook with pre-receive and post-receive hooks. - Replace update hook with pre-receive and post-receive hooks.
- Ignore missing repositories in create-hooks - Ignore missing repositories in create-hooks
- Connect to Redis via sockets by default
v1.9.7 v1.9.7
- Increased test coverage - Increased test coverage
......
...@@ -27,11 +27,11 @@ auth_file: "/home/git/.ssh/authorized_keys" ...@@ -27,11 +27,11 @@ auth_file: "/home/git/.ssh/authorized_keys"
# Redis settings used for pushing commit notices to gitlab # Redis settings used for pushing commit notices to gitlab
redis: redis:
bin: /usr/bin/redis-cli bin: /usr/bin/redis-cli
host: 127.0.0.1 # host: 127.0.0.1
port: 6379 # port: 6379
# pass: redispass # Allows you to specify the password for Redis # pass: redispass # Allows you to specify the password for Redis
# socket: /tmp/redis.socket # Only define this if you want to use sockets
database: 0 database: 0
socket: /var/run/redis/redis.sock # Comment out this line if you want to use TCP
namespace: resque:gitlab namespace: resque:gitlab
# Log file. # Log file.
......
...@@ -5,20 +5,27 @@ describe GitlabConfig do ...@@ -5,20 +5,27 @@ describe GitlabConfig do
let(:config) { GitlabConfig.new } let(:config) { GitlabConfig.new }
describe :redis do describe :redis do
subject { config.redis } before do
config.instance_variable_set(:@config, YAML.load(<<eos
it { should be_a(Hash) } redis:
it { should have_key('bin') } bin: /usr/bin/redis-cli
it { should have_key('host') } host: 127.0.1.1
it { should have_key('port') } port: 6378
it { should have_key('database') } pass: secure
it { should have_key('namespace') } database: 1
socket: /var/run/redis/redis.sock
namespace: my:gitlab
eos
))
end end
describe :redis_namespace do it { config.redis['bin'].should eq('/usr/bin/redis-cli') }
subject { config.redis_namespace } it { config.redis['host'].should eq('127.0.1.1') }
it { config.redis['port'].should eq(6378) }
it { should eq('resque:gitlab') } it { config.redis['database'].should eq(1) }
it { config.redis['namespace'].should eq('my:gitlab') }
it { config.redis['socket'].should eq('/var/run/redis/redis.sock') }
it { config.redis['pass'].should eq('secure') }
end end
describe :gitlab_url do describe :gitlab_url do
...@@ -39,11 +46,6 @@ describe GitlabConfig do ...@@ -39,11 +46,6 @@ describe GitlabConfig do
describe :redis_command do describe :redis_command do
subject { config.redis_command } subject { config.redis_command }
it { should be_an(Array) }
it { should include(config.redis['host']) }
it { should include(config.redis['bin']) }
it { should include(config.redis['port'].to_s) }
context "with empty redis config" do context "with empty redis config" do
before do before do
config.stub(:redis) { {} } config.stub(:redis) { {} }
...@@ -53,6 +55,17 @@ describe GitlabConfig do ...@@ -53,6 +55,17 @@ describe GitlabConfig do
it { should include('redis-cli') } it { should include('redis-cli') }
end end
context "with host and port" do
before do
config.stub(:redis) { {'host' => 'localhost', 'port' => 1123, 'bin' => '/usr/bin/redis-cli'} }
end
it { should be_an(Array) }
it { should include(config.redis['host']) }
it { should include(config.redis['bin']) }
it { should include(config.redis['port'].to_s) }
end
context "with redis socket" do context "with redis socket" do
let(:socket) { '/tmp/redis.socket' } let(:socket) { '/tmp/redis.socket' }
before do before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment