heartcheck-redis 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f5b232320390db1dde08456842fb91d00a36415c
4
+ data.tar.gz: ee4ad96dc9d5a2ab249be94d84d1ff911ae5c240
5
+ SHA512:
6
+ metadata.gz: 48aec41e115dde1416a9f303acd1172d1a1440ea8063f16bda3956d89c1fa6ebf73a67e13c99db8aeb7722da8f38048ed964e21a6e3ec73bc43e65885183dafc
7
+ data.tar.gz: 2a51a671782f10a13196071d8a1e752118a1f28c80d93a340c093bf65bbb07e072dd8651a4e5a2a36c853c98d02d21c0bac31208b3499d8b704bdea1013877b5
@@ -0,0 +1,60 @@
1
+ module Heartcheck
2
+ module Checks
3
+ # Check for a redis service
4
+ # Base is set in heartcheck gem
5
+ class Redis < Base
6
+ # validate each service
7
+ #
8
+ # @retun [void]
9
+ def validate
10
+ services.each do |service|
11
+ connection = service[:connection]
12
+
13
+ append_error(service[:name], :set) unless set?(connection)
14
+ append_error(service[:name], :get) unless get?(connection)
15
+ append_error(service[:name], :delete) unless del?(connection)
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ # test if can write on redis
22
+ #
23
+ # @param con [Redis] an instance of redis
24
+ #
25
+ # @return [Bollean]
26
+ def set?(con)
27
+ con.set('check_test', 'heartcheck') == 'OK'
28
+ end
29
+
30
+ # test if can read on redis
31
+ #
32
+ # @param con [Redis] an instance of redis
33
+ #
34
+ # @return [Bollean]
35
+ def get?(con)
36
+ con.get('check_test') == 'heartcheck'
37
+ end
38
+
39
+ # test if can delete on redis
40
+ #
41
+ # @param con [Redis] an instance of redis
42
+ #
43
+ # @return [Bollean]
44
+ def del?(con)
45
+ con.del('check_test') == 1
46
+ end
47
+
48
+ # customize the error message
49
+ # It's called in Heartcheck::Checks::Base#append_error
50
+ #
51
+ # @param name [String] An identifier of service
52
+ # @param key_error [Symbol] name of action
53
+ #
54
+ # @return [void]
55
+ def custom_error(name, key_error)
56
+ @errors << "#{name} fails to #{key_error}"
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,7 @@
1
+ # from hearcheck gem
2
+ module Heartcheck
3
+ # gem version
4
+ module Redis
5
+ VERSION = '1.0.0'
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ require 'redis'
2
+ require 'heartcheck'
3
+ require 'heartcheck/checks/redis'
metadata ADDED
@@ -0,0 +1,188 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: heartcheck-redis
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Locaweb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: heartcheck
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: redis
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 3.2.0
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.2.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 3.2.0
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.2.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: pry-nav
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.2.0
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 0.2.4
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.2.0
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 0.2.4
73
+ - !ruby/object:Gem::Dependency
74
+ name: rspec
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: 3.1.0
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.1.0
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.1.0
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 3.1.0
93
+ - !ruby/object:Gem::Dependency
94
+ name: rubocop
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: 0.27.0
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.27.1
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: 0.27.0
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.27.1
113
+ - !ruby/object:Gem::Dependency
114
+ name: yard
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: 0.8.0
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 0.8.7
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: 0.8.0
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 0.8.7
133
+ - !ruby/object:Gem::Dependency
134
+ name: redcarpet
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: 3.2.0
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: 3.2.2
143
+ type: :development
144
+ prerelease: false
145
+ version_requirements: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - "~>"
148
+ - !ruby/object:Gem::Version
149
+ version: 3.2.0
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 3.2.2
153
+ description: Plugin to check redis connection in heartcheck.
154
+ email:
155
+ - desenvolvedores@locaweb.com.br
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - lib/heartcheck/checks/redis.rb
161
+ - lib/heartcheck/redis.rb
162
+ - lib/heartcheck/redis/version.rb
163
+ homepage: http://developer.locaweb.com.br
164
+ licenses:
165
+ - MIT
166
+ metadata: {}
167
+ post_install_message:
168
+ rdoc_options: []
169
+ require_paths:
170
+ - lib
171
+ required_ruby_version: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - ">="
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubyforge_project:
183
+ rubygems_version: 2.4.5
184
+ signing_key:
185
+ specification_version: 4
186
+ summary: A redis checker.
187
+ test_files: []
188
+ has_rdoc: