easymon 1.4 → 1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/easymon/checks_controller.rb +2 -2
- data/lib/easymon/checks/active_record_mysql_writeable_check.rb +26 -0
- data/lib/easymon/checks/redis_check.rb +9 -5
- data/lib/easymon/checks/redis_writeable_check.rb +36 -0
- data/lib/easymon/version.rb +1 -1
- data/lib/easymon.rb +2 -0
- data/test/dummy/log/development.log +24 -0
- data/test/dummy/log/test.log +6944 -873
- data/test/dummy/tmp/cache/4D4/7A0/health_check +1 -0
- data/test/unit/checks/active_record_mysql_writeable_check_test.rb +27 -0
- data/test/unit/checks/redis_writeable_check_test.rb +28 -0
- metadata +11 -4
@@ -0,0 +1 @@
|
|
1
|
+
o: ActiveSupport::Cache::Entry :@valuei:
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ActiveRecordMysqlWriteableCheckTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test "#check returns a successful result on a good run" do
|
6
|
+
check = create_check
|
7
|
+
results = check.check
|
8
|
+
|
9
|
+
assert_equal(true, results[0])
|
10
|
+
assert_equal("@@read_only is 0", results[1])
|
11
|
+
end
|
12
|
+
|
13
|
+
test "#check returns a failed result on a failed run" do
|
14
|
+
# Return a mock'd object that responds to .entries that returns [[0]]
|
15
|
+
ActiveRecord::Base.connection.stubs(:execute).returns(mock().stubs(:entries).returns([[1]]))
|
16
|
+
check = create_check
|
17
|
+
results = check.check
|
18
|
+
|
19
|
+
assert_equal(false, results[0])
|
20
|
+
assert_equal("@@read_only is 1", results[1])
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def create_check
|
25
|
+
Easymon::ActiveRecordMysqlWriteableCheck.new(ActiveRecord::Base)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RedisWriteableCheckTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test "#run sets success conditions on successful run" do
|
6
|
+
Redis.any_instance.stubs(:set).returns("OK")
|
7
|
+
check = create_check
|
8
|
+
results = check.check
|
9
|
+
|
10
|
+
assert_equal("Writeable", results[1])
|
11
|
+
assert_equal(true, results[0])
|
12
|
+
end
|
13
|
+
|
14
|
+
test "#run sets failure conditions on a failed run" do
|
15
|
+
Redis.any_instance.stubs(:set).raises(Redis::ConnectionError.new)
|
16
|
+
check = create_check
|
17
|
+
results = check.check
|
18
|
+
|
19
|
+
assert_equal("Read Only", results[1])
|
20
|
+
assert_equal(false, results[0])
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
def create_check
|
25
|
+
# Get us a config hash from disk in this case
|
26
|
+
Easymon::RedisWriteableCheck.new(YAML.load_file(Rails.root.join("config/redis.yml"))[Rails.env].symbolize_keys)
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easymon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Anderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -125,9 +125,11 @@ files:
|
|
125
125
|
- lib/easymon.rb
|
126
126
|
- lib/easymon/checklist.rb
|
127
127
|
- lib/easymon/checks/active_record_check.rb
|
128
|
+
- lib/easymon/checks/active_record_mysql_writeable_check.rb
|
128
129
|
- lib/easymon/checks/http_check.rb
|
129
130
|
- lib/easymon/checks/memcached_check.rb
|
130
131
|
- lib/easymon/checks/redis_check.rb
|
132
|
+
- lib/easymon/checks/redis_writeable_check.rb
|
131
133
|
- lib/easymon/checks/semaphore_check.rb
|
132
134
|
- lib/easymon/checks/split_active_record_check.rb
|
133
135
|
- lib/easymon/checks/traffic_enabled_check.rb
|
@@ -178,15 +180,18 @@ files:
|
|
178
180
|
- test/dummy/public/500.html
|
179
181
|
- test/dummy/public/favicon.ico
|
180
182
|
- test/dummy/script/rails
|
183
|
+
- test/dummy/tmp/cache/4D4/7A0/health_check
|
181
184
|
- test/helpers/easymon/checks_helper_test.rb
|
182
185
|
- test/integration/navigation_test.rb
|
183
186
|
- test/test_helper.rb
|
184
187
|
- test/unit/checklist_test.rb
|
185
188
|
- test/unit/checks/active_record_check_on_postgresql_test.rb
|
186
189
|
- test/unit/checks/active_record_check_test.rb
|
190
|
+
- test/unit/checks/active_record_mysql_writeable_check_test.rb
|
187
191
|
- test/unit/checks/http_check_test.rb
|
188
192
|
- test/unit/checks/memcached_check_test.rb
|
189
193
|
- test/unit/checks/redis_check_test.rb
|
194
|
+
- test/unit/checks/redis_writeable_check_test.rb
|
190
195
|
- test/unit/checks/semaphore_check_test.rb
|
191
196
|
- test/unit/checks/split_active_record_check_test.rb
|
192
197
|
- test/unit/checks/traffic_enabled_check_test.rb
|
@@ -210,14 +215,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
215
|
- !ruby/object:Gem::Version
|
211
216
|
version: '0'
|
212
217
|
requirements: []
|
213
|
-
|
214
|
-
rubygems_version: 2.7.6
|
218
|
+
rubygems_version: 3.1.6
|
215
219
|
signing_key:
|
216
220
|
specification_version: 4
|
217
221
|
summary: Simple availability checks for your rails app
|
218
222
|
test_files:
|
219
223
|
- test/unit/checks/memcached_check_test.rb
|
220
224
|
- test/unit/checks/http_check_test.rb
|
225
|
+
- test/unit/checks/active_record_mysql_writeable_check_test.rb
|
226
|
+
- test/unit/checks/redis_writeable_check_test.rb
|
221
227
|
- test/unit/checks/semaphore_check_test.rb
|
222
228
|
- test/unit/checks/active_record_check_test.rb
|
223
229
|
- test/unit/checks/active_record_check_on_postgresql_test.rb
|
@@ -265,6 +271,7 @@ test_files:
|
|
265
271
|
- test/dummy/public/404.html
|
266
272
|
- test/dummy/log/test.log
|
267
273
|
- test/dummy/log/development.log
|
274
|
+
- test/dummy/tmp/cache/4D4/7A0/health_check
|
268
275
|
- test/dummy/README.rdoc
|
269
276
|
- test/integration/navigation_test.rb
|
270
277
|
- test/test_helper.rb
|