easymon 1.5 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46eed6312dd05be2f1cc453b481dbbe26cbed28e6a9954d68aee4ed96b5d2935
4
- data.tar.gz: 57a512d8baf55d331a7386ccc80ea9879820cb2775327d321ba8d11d0b630660
3
+ metadata.gz: cb55744be4fa12e4c7af34ae59091721967aaf08d1bd07e4bc0cca4bd2937c4a
4
+ data.tar.gz: ed1822f256bea98b6982f634487c676fad7e292ca093c10315ce72990ffb6778
5
5
  SHA512:
6
- metadata.gz: cfe6ee337e9353b08dd9dcb7b807f2f8881d471e884257fd8a21e48bf29f79fb6680ba29a56b2cea2b40ac365d46ca9566fa89c1df98808832e11bf93d45ee66
7
- data.tar.gz: 13e4c388db907301c04ed04a3fe25b8eba77b78e88496d3b1ac1a993980fb65ecf75db24c91b1f90ad230b47ad4c70919b973b587280a7ec9bd95d6b09433291
6
+ metadata.gz: bd39994e506c00177688ae9ecb7ff660326cc44eec4374cdeb42873c3128bec45da18dfb54969b9a6494fb0d79ef1d87be4d223c4ef162a70bfc5d4db4345e9a
7
+ data.tar.gz: a6515ddbd1f7a0bce037815d8804c2c7689dfc943c1ad9c7f037d711ff41700efcc6367e261b2bd3a80b43590e30ef2523ec2bd639537aac7eada9fa5f000bbd
data/README.md CHANGED
@@ -203,7 +203,7 @@ module Easymon
203
203
  end
204
204
  end
205
205
  def database_configuration
206
- env = "#{Rails.env}_slave"
206
+ env = "#{Rails.env}_replica"
207
207
  config = YAML.load_file(Rails.root.join('config/database.yml'))[env]
208
208
  end
209
209
  end
@@ -2,10 +2,10 @@ module Easymon
2
2
  class SplitActiveRecordCheck
3
3
  attr_accessor :block
4
4
  attr_accessor :results
5
-
5
+
6
6
  # Here we pass a block so we get a fresh instance of ActiveRecord::Base or
7
7
  # whatever other class we might be using to make database connections
8
- #
8
+ #
9
9
  # For example, given the following other class:
10
10
  # module Easymon
11
11
  # class Base < ActiveRecord::Base
@@ -18,12 +18,12 @@ module Easymon
18
18
  # end
19
19
  #
20
20
  # def database_configuration
21
- # env = "#{Rails.env}_slave"
21
+ # env = "#{Rails.env}_replica"
22
22
  # config = YAML.load_file(Rails.root.join('config/database.yml'))[env]
23
23
  # end
24
24
  # end
25
25
  # end
26
- #
26
+ #
27
27
  # We would check both it and ActiveRecord::Base like so:
28
28
  # check = Easymon::SplitActiveRecordCheck.new {
29
29
  # [ActiveRecord::Base.connection, Easymon::Base.connection]
@@ -31,20 +31,20 @@ module Easymon
31
31
  # Easymon::Repository.add("split-database", check)
32
32
  def initialize(&block)
33
33
  self.block = block
34
- end
35
-
34
+ end
35
+
36
36
  # Assumes only 2 connections
37
37
  def check
38
38
  connections = Array(@block.call)
39
39
 
40
40
  results = connections.map{|connection| database_up?(connection) }
41
-
42
- master_status = results.first ? "Master: Up" : "Master: Down"
43
- slave_status = results.last ? "Slave: Up" : "Slave: Down"
44
-
45
- [(results.all? && results.count > 0), "#{master_status} - #{slave_status}"]
41
+
42
+ primary_status = results.first ? "Primary: Up" : "Primary: Down"
43
+ replica_status = results.last ? "Replica: Up" : "Replica: Down"
44
+
45
+ [(results.all? && results.count > 0), "#{primary_status} - #{replica_status}"]
46
46
  end
47
-
47
+
48
48
  private
49
49
  def database_up?(connection)
50
50
  connection.active?
@@ -1,3 +1,3 @@
1
1
  module Easymon
2
- VERSION = "1.5"
2
+ VERSION = "1.6.0"
3
3
  end
File without changes
@@ -17,10 +17,10 @@ test:
17
17
  host: 127.0.0.1
18
18
  port: 3306
19
19
 
20
- test_slave:
20
+ test_replica:
21
21
  adapter: mysql2
22
22
  encoding: utf8
23
- database: dummy_test_slave
23
+ database: dummy_test_replica
24
24
  username: root
25
25
  host: 127.0.0.1
26
26
  port: 3306
File without changes
data/test/test_helper.rb CHANGED
@@ -34,4 +34,4 @@ end
34
34
 
35
35
  # setting up mocha *after* we load the test libraries as per
36
36
  # http://gofreerange.com/mocha/docs/
37
- require 'mocha/mini_test'
37
+ require 'mocha/minitest'
@@ -3,50 +3,50 @@ require 'test_helper'
3
3
  class SplitActiveRecordCheckTest < ActiveSupport::TestCase
4
4
 
5
5
  test "#run sets success conditions on successful run" do
6
- master = ActiveRecord::Base.connection
6
+ primary = ActiveRecord::Base.connection
7
7
  Easymon::Base.establish_connection
8
- slave = Easymon::Base.connection
8
+ replica = Easymon::Base.connection
9
9
 
10
- check = Easymon::SplitActiveRecordCheck.new { [master, slave] }
10
+ check = Easymon::SplitActiveRecordCheck.new { [primary, replica] }
11
11
 
12
12
  results = check.check
13
13
 
14
- assert_equal("Master: Up - Slave: Up", results[1])
14
+ assert_equal("Primary: Up - Replica: Up", results[1])
15
15
  assert_equal(true, results[0])
16
16
  end
17
17
 
18
- test "#run sets failed conditions when slave is down" do
19
- master = ActiveRecord::Base.connection
18
+ test "#run sets failed conditions when replica is down" do
19
+ primary = ActiveRecord::Base.connection
20
20
  Easymon::Base.establish_connection
21
- slave = Easymon::Base.connection
21
+ replica = Easymon::Base.connection
22
22
 
23
- slave.stubs(:active?).raises("boom")
23
+ replica.stubs(:active?).raises("boom")
24
24
 
25
- check = Easymon::SplitActiveRecordCheck.new { [master, slave] }
25
+ check = Easymon::SplitActiveRecordCheck.new { [primary, replica] }
26
26
  results = check.check
27
27
 
28
- assert_equal("Master: Up - Slave: Down", results[1])
28
+ assert_equal("Primary: Up - Replica: Down", results[1])
29
29
  assert_equal(false, results[0])
30
30
  end
31
31
 
32
- test "#run sets failed conditions when master is down" do
33
- master = ActiveRecord::Base.connection
32
+ test "#run sets failed conditions when primary is down" do
33
+ primary = ActiveRecord::Base.connection
34
34
  Easymon::Base.establish_connection
35
- slave = Easymon::Base.connection
35
+ replica = Easymon::Base.connection
36
36
 
37
- master.stubs(:active?).raises("boom")
37
+ primary.stubs(:active?).raises("boom")
38
38
 
39
- check = Easymon::SplitActiveRecordCheck.new { [master, slave] }
39
+ check = Easymon::SplitActiveRecordCheck.new { [primary, replica] }
40
40
  results = check.check
41
41
 
42
- assert_equal("Master: Down - Slave: Up", results[1])
42
+ assert_equal("Primary: Down - Replica: Up", results[1])
43
43
  assert_equal(false, results[0])
44
44
  end
45
45
 
46
46
  test "given nil as a config" do
47
47
  check = Easymon::SplitActiveRecordCheck.new { }
48
48
  results = check.check
49
- assert_equal("Master: Down - Slave: Down", results[1])
49
+ assert_equal("Primary: Down - Replica: Down", results[1])
50
50
  assert_equal(false, results[0])
51
51
  end
52
52
  end
@@ -63,8 +63,8 @@ module Easymon
63
63
  end
64
64
 
65
65
  def database_configuration
66
- env = "#{Rails.env}_slave"
67
- config = YAML.load_file(Rails.root.join('config/database.yml'))[env]
66
+ env = "#{Rails.env}_replica"
67
+ YAML.load_file(Rails.root.join('config/database.yml'))[env]
68
68
  end
69
69
  end
70
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easymon
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.5'
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Anderson
@@ -70,28 +70,28 @@ dependencies:
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: '0.18'
73
+ version: '1.2'
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: '0.18'
80
+ version: '1.2'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: mocha
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: '1.1'
87
+ version: '1.11'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: '1.1'
94
+ version: '1.11'
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: dalli
97
97
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +142,7 @@ files:
142
142
  - test/controllers/easymon/checks_controller_test.rb
143
143
  - test/dummy/README.rdoc
144
144
  - test/dummy/Rakefile
145
+ - test/dummy/app/assets/config/manifest.js
145
146
  - test/dummy/app/assets/javascripts/application.js
146
147
  - test/dummy/app/assets/javascripts/easymon.js
147
148
  - test/dummy/app/assets/stylesheets/application.css
@@ -173,6 +174,7 @@ files:
173
174
  - test/dummy/config/memcached.yml
174
175
  - test/dummy/config/redis.yml
175
176
  - test/dummy/config/routes.rb
177
+ - test/dummy/config/storage.yml
176
178
  - test/dummy/log/development.log
177
179
  - test/dummy/log/test.log
178
180
  - test/dummy/public/404.html
@@ -237,6 +239,7 @@ test_files:
237
239
  - test/dummy/app/views/easymon/index.html.erb
238
240
  - test/dummy/app/views/easymon/show.html.erb
239
241
  - test/dummy/app/views/layouts/application.html.erb
242
+ - test/dummy/app/assets/config/manifest.js
240
243
  - test/dummy/app/assets/javascripts/easymon.js
241
244
  - test/dummy/app/assets/javascripts/application.js
242
245
  - test/dummy/app/assets/stylesheets/application.css
@@ -250,6 +253,7 @@ test_files:
250
253
  - test/dummy/config/environments/test.rb
251
254
  - test/dummy/config/environment.rb
252
255
  - test/dummy/config/redis.yml
256
+ - test/dummy/config/storage.yml
253
257
  - test/dummy/config/application.rb
254
258
  - test/dummy/config/memcached.yml
255
259
  - test/dummy/config/database.yml