Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-shell
Commits
3c49cb02
Commit
3c49cb02
authored
Aug 18, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specs for sentinel support
parent
0a24df33
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
spec/fixtures/gitlab_config_redis.yml
spec/fixtures/gitlab_config_redis.yml
+12
-0
spec/gitlab_config_spec.rb
spec/gitlab_config_spec.rb
+3
-11
spec/gitlab_net_spec.rb
spec/gitlab_net_spec.rb
+14
-0
No files found.
spec/fixtures/gitlab_config_redis.yml
0 → 100644
View file @
3c49cb02
redis
:
bin
:
/usr/bin/redis-cli
host
:
127.0.1.1
port
:
6378
pass
:
secure
database
:
1
socket
:
/var/run/redis/redis.sock
namespace
:
my:gitlab
sentinels
:
-
host
:
127.0.0.1
port
:
26380
spec/gitlab_config_spec.rb
View file @
3c49cb02
...
@@ -6,17 +6,8 @@ describe GitlabConfig do
...
@@ -6,17 +6,8 @@ describe GitlabConfig do
describe
:redis
do
describe
:redis
do
before
do
before
do
config
.
instance_variable_set
(
:@config
,
YAML
.
load
(
<<
eos
config_file
=
File
.
read
(
'spec/fixtures/gitlab_config_redis.yml'
)
redis:
config
.
instance_variable_set
(
:@config
,
YAML
.
load
(
config_file
))
bin: /usr/bin/redis-cli
host: 127.0.1.1
port: 6378
pass: secure
database: 1
socket: /var/run/redis/redis.sock
namespace: my:gitlab
eos
))
end
end
it
{
config
.
redis
[
'bin'
].
should
eq
(
'/usr/bin/redis-cli'
)
}
it
{
config
.
redis
[
'bin'
].
should
eq
(
'/usr/bin/redis-cli'
)
}
...
@@ -26,6 +17,7 @@ eos
...
@@ -26,6 +17,7 @@ eos
it
{
config
.
redis
[
'namespace'
].
should
eq
(
'my:gitlab'
)
}
it
{
config
.
redis
[
'namespace'
].
should
eq
(
'my:gitlab'
)
}
it
{
config
.
redis
[
'socket'
].
should
eq
(
'/var/run/redis/redis.sock'
)
}
it
{
config
.
redis
[
'socket'
].
should
eq
(
'/var/run/redis/redis.sock'
)
}
it
{
config
.
redis
[
'pass'
].
should
eq
(
'secure'
)
}
it
{
config
.
redis
[
'pass'
].
should
eq
(
'secure'
)
}
it
{
config
.
redis
[
'sentinels'
].
should
eq
([{
'host'
=>
'127.0.0.1'
,
'port'
=>
26380
}])
}
end
end
describe
:gitlab_url
do
describe
:gitlab_url
do
...
...
spec/gitlab_net_spec.rb
View file @
3c49cb02
...
@@ -306,6 +306,20 @@ describe GitlabNet, vcr: true do
...
@@ -306,6 +306,20 @@ describe GitlabNet, vcr: true do
end
end
end
end
context
"with sentinels"
do
it
'users the specified sentinels'
do
allow
(
gitlab_net
).
to
receive
(
:config
).
and_return
(
config
)
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
,
sentinels:
[{
host:
'127.0.0.1'
,
port:
26380
}]
}).
and_call_original
gitlab_net
.
redis_client
end
end
context
"with redis socket"
do
context
"with redis socket"
do
let
(
:socket
)
{
'/tmp/redis.socket'
}
let
(
:socket
)
{
'/tmp/redis.socket'
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment