easymon 1.4.2 → 1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- o: ActiveSupport::Cache::Entry : @valuei:
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.2
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: 2018-11-23 00:00:00.000000000 Z
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
@@ -185,9 +187,11 @@ files:
185
187
  - test/unit/checklist_test.rb
186
188
  - test/unit/checks/active_record_check_on_postgresql_test.rb
187
189
  - test/unit/checks/active_record_check_test.rb
190
+ - test/unit/checks/active_record_mysql_writeable_check_test.rb
188
191
  - test/unit/checks/http_check_test.rb
189
192
  - test/unit/checks/memcached_check_test.rb
190
193
  - test/unit/checks/redis_check_test.rb
194
+ - test/unit/checks/redis_writeable_check_test.rb
191
195
  - test/unit/checks/semaphore_check_test.rb
192
196
  - test/unit/checks/split_active_record_check_test.rb
193
197
  - test/unit/checks/traffic_enabled_check_test.rb
@@ -211,14 +215,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
215
  - !ruby/object:Gem::Version
212
216
  version: '0'
213
217
  requirements: []
214
- rubyforge_project:
215
- rubygems_version: 2.7.6
218
+ rubygems_version: 3.1.6
216
219
  signing_key:
217
220
  specification_version: 4
218
221
  summary: Simple availability checks for your rails app
219
222
  test_files:
220
223
  - test/unit/checks/memcached_check_test.rb
221
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
222
227
  - test/unit/checks/semaphore_check_test.rb
223
228
  - test/unit/checks/active_record_check_test.rb
224
229
  - test/unit/checks/active_record_check_on_postgresql_test.rb