gesund-redis 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +5 -0
- data/Gemfile.lock +9 -3
- data/gesund-redis.gemspec +1 -2
- data/lib/gesund/checks/redis_connection.rb +7 -5
- data/lib/gesund/redis.rb +1 -0
- data/lib/gesund/redis/version.rb +1 -1
- data/spec/lib/gesund/checks/redis_connection_spec.rb +19 -0
- data/spec/lib/gesund/redis/version_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +10 -24
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gesund-redis (0.0.
|
5
|
-
gesund
|
4
|
+
gesund-redis (0.0.2)
|
5
|
+
gesund (~> 0.0.3)
|
6
6
|
redis
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
diff-lcs (1.2.4)
|
12
|
-
gesund (0.0.
|
12
|
+
gesund (0.0.3)
|
13
13
|
rack
|
14
14
|
thor
|
15
|
+
multi_json (1.7.2)
|
15
16
|
rack (1.5.2)
|
16
17
|
rake (10.0.4)
|
17
18
|
redis (3.0.4)
|
@@ -23,6 +24,10 @@ GEM
|
|
23
24
|
rspec-expectations (2.13.0)
|
24
25
|
diff-lcs (>= 1.1.3, < 2.0)
|
25
26
|
rspec-mocks (2.13.1)
|
27
|
+
simplecov (0.7.1)
|
28
|
+
multi_json (~> 1.0)
|
29
|
+
simplecov-html (~> 0.7.1)
|
30
|
+
simplecov-html (0.7.1)
|
26
31
|
thor (0.18.1)
|
27
32
|
|
28
33
|
PLATFORMS
|
@@ -33,3 +38,4 @@ DEPENDENCIES
|
|
33
38
|
gesund-redis!
|
34
39
|
rake
|
35
40
|
rspec
|
41
|
+
simplecov
|
data/gesund-redis.gemspec
CHANGED
@@ -20,8 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "rspec"
|
24
23
|
|
25
|
-
spec.add_runtime_dependency "gesund"
|
24
|
+
spec.add_runtime_dependency "gesund", "~> 0.0.3"
|
26
25
|
spec.add_runtime_dependency "redis"
|
27
26
|
end
|
@@ -3,13 +3,15 @@ require "redis"
|
|
3
3
|
module Gesund::Checks
|
4
4
|
class RedisConnection
|
5
5
|
include Gesund::Check
|
6
|
-
def initialize(options)
|
6
|
+
def initialize(options={})
|
7
7
|
begin
|
8
|
-
|
9
|
-
|
8
|
+
if ::Redis.new(options).ping == "PONG"
|
9
|
+
self.pass "Redis PING = PONG"
|
10
|
+
else
|
11
|
+
self.fail "Redis PING != PONG"
|
12
|
+
end
|
10
13
|
rescue => e
|
11
|
-
self.
|
12
|
-
self.success = false
|
14
|
+
self.fail "#{self.class} ERROR: #{e.class}: #{e.message}"
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
data/lib/gesund/redis.rb
CHANGED
data/lib/gesund/redis/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Gesund::Checks::RedisConnection do
|
4
|
+
it "passes when redis returns PONG on a ping" do
|
5
|
+
::Redis.stub_chain(:new, :ping).and_return("PONG")
|
6
|
+
subject.success.should be_true
|
7
|
+
subject.message.should match "Redis PING = PONG"
|
8
|
+
end
|
9
|
+
it "fails when redis returns non-PONG on a ping" do
|
10
|
+
::Redis.stub_chain(:new, :ping).and_return("something very bad")
|
11
|
+
subject.success.should be_false
|
12
|
+
subject.message.should match "Redis PING != PONG"
|
13
|
+
end
|
14
|
+
it "fails when redis raises an exception" do
|
15
|
+
::Redis.stub(:new).and_raise("something bad")
|
16
|
+
subject.success.should be_false
|
17
|
+
subject.message.should match "RedisConnection ERROR: RuntimeError: something bad"
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "bundler/setup"
|
2
|
+
require File.expand_path "../../lib/gesund/redis", __FILE__
|
2
3
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
3
4
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
4
5
|
# Require this file using `require "spec_helper"` to ensure that it is only
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gesund-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -43,38 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: rspec
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
46
|
- !ruby/object:Gem::Dependency
|
63
47
|
name: gesund
|
64
48
|
requirement: !ruby/object:Gem::Requirement
|
65
49
|
none: false
|
66
50
|
requirements:
|
67
|
-
- -
|
51
|
+
- - ~>
|
68
52
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
53
|
+
version: 0.0.3
|
70
54
|
type: :runtime
|
71
55
|
prerelease: false
|
72
56
|
version_requirements: !ruby/object:Gem::Requirement
|
73
57
|
none: false
|
74
58
|
requirements:
|
75
|
-
- -
|
59
|
+
- - ~>
|
76
60
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
61
|
+
version: 0.0.3
|
78
62
|
- !ruby/object:Gem::Dependency
|
79
63
|
name: redis
|
80
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,6 +94,7 @@ files:
|
|
110
94
|
- lib/gesund/checks/redis_connection.rb
|
111
95
|
- lib/gesund/redis.rb
|
112
96
|
- lib/gesund/redis/version.rb
|
97
|
+
- spec/lib/gesund/checks/redis_connection_spec.rb
|
113
98
|
- spec/lib/gesund/redis/version_spec.rb
|
114
99
|
- spec/spec_helper.rb
|
115
100
|
homepage: ''
|
@@ -127,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
112
|
version: '0'
|
128
113
|
segments:
|
129
114
|
- 0
|
130
|
-
hash:
|
115
|
+
hash: 2859466867402775428
|
131
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
117
|
none: false
|
133
118
|
requirements:
|
@@ -136,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
121
|
version: '0'
|
137
122
|
segments:
|
138
123
|
- 0
|
139
|
-
hash:
|
124
|
+
hash: 2859466867402775428
|
140
125
|
requirements: []
|
141
126
|
rubyforge_project:
|
142
127
|
rubygems_version: 1.8.25
|
@@ -144,5 +129,6 @@ signing_key:
|
|
144
129
|
specification_version: 3
|
145
130
|
summary: Redis health checks for Gesund
|
146
131
|
test_files:
|
132
|
+
- spec/lib/gesund/checks/redis_connection_spec.rb
|
147
133
|
- spec/lib/gesund/redis/version_spec.rb
|
148
134
|
- spec/spec_helper.rb
|