diff options
author | Robert Speicher <robert@gitlab.com> | 2016-08-19 18:55:30 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-08-19 18:55:30 +0000 |
commit | 3043b31c458bf720843a84b35c9fbad5c1488c1d (patch) | |
tree | b90e1df74cc8c53c891f06912e65575fd0f2be48 /spec/gitlab_net_spec.rb | |
parent | 4f8e91fac043f09ea94a3542eeff9734db33645a (diff) | |
parent | ee684a0973b2f5fbb30fcf2f1b3099564ca15ac9 (diff) | |
download | gitlab-shell-3.4.0.tar.gz |
Merge branch 'feature/redis-sentinel' into 'master'
v3.4.0
Sentinel Support
Sentinel connection parameters in `config.yml` file.
Fixes #29
See merge request !85
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r-- | spec/gitlab_net_spec.rb | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb index 2bbf98b..d4585d2 100644 --- a/spec/gitlab_net_spec.rb +++ b/spec/gitlab_net_spec.rb @@ -276,32 +276,34 @@ describe GitlabNet, vcr: true do expect_any_instance_of(Redis).to receive(:initialize).with({ host: '127.0.0.1', port: 6379, - db: 0 }).and_call_original + db: 0 }) gitlab_net.redis_client end end - context "with host and port" do - it 'uses the specified host and port' do + context "with password" do + it 'uses the specified host, port, and password' do allow(gitlab_net).to receive(:config).and_return(config) - allow(config).to receive(:redis).and_return( { 'host' => 'localhost', 'port' => 1123 } ) + allow(config).to receive(:redis).and_return( { 'host' => 'localhost', 'port' => 1123, 'pass' => 'secret' } ) expect_any_instance_of(Redis).to receive(:initialize).with({ host: 'localhost', port: 1123, - db: 0 }).and_call_original + db: 0, + password: 'secret'}) gitlab_net.redis_client end end - context "with password" do - it 'uses the specified host, port, and password' do + context "with sentinels" do + it 'uses the specified sentinels' do allow(gitlab_net).to receive(:config).and_return(config) - allow(config).to receive(:redis).and_return( { 'host' => 'localhost', 'port' => 1123, 'pass' => 'secret' } ) + allow(config).to receive(:redis).and_return({ 'host' => 'localhost', 'port' => 1123, + 'sentinels' => [{'host' => '127.0.0.1', 'port' => 26380}] }) expect_any_instance_of(Redis).to receive(:initialize).with({ host: 'localhost', port: 1123, db: 0, - password: 'secret'}).and_call_original + sentinels: [{host: '127.0.0.1', port: 26380}] }) gitlab_net.redis_client end end @@ -314,7 +316,7 @@ describe GitlabNet, vcr: true do allow(gitlab_net).to receive(:config).and_return(config) allow(config).to receive(:redis).and_return( { 'socket' => socket }) - expect_any_instance_of(Redis).to receive(:initialize).with({ path: socket, db: 0 }).and_call_original + expect_any_instance_of(Redis).to receive(:initialize).with({ path: socket, db: 0 }) gitlab_net.redis_client end end |