health_monitor_lb 1.0.0 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5c7c695382a747e409feb32c8140500f0481be76d2c6a3d734faa12e328682e
4
- data.tar.gz: '086859234d7b215306081c53d48fdfb54cf940f5d75b05a18bbed8c5cde99186'
3
+ metadata.gz: 10859ba4ff5c605345ae3a5980c47a573a058fe5b890574a0fcc702b6318cbb1
4
+ data.tar.gz: 286432d349f9e20743264685a4f3a97ee5852c6239f01bfab043129019fcb166
5
5
  SHA512:
6
- metadata.gz: b8a0d67c9e4059adbb8805ec7a9b8f8bd0ee70c7436dfb55425d7bef55657c9c84733c94993143a7762a7e15cd4cc4c844c2c12235ffb0d0004f10c49b3656ae
7
- data.tar.gz: 32a1358c803e76eb469eb8b001506613571d2073e648eedcff21bae1ddf280c8fd697a672caaf9e3ef906ebc14caf08554766e94673144eea53c450e97edb813
6
+ metadata.gz: c38c71932fbc6115176d05bec121fc1ab3b0437daa7b06160799a00711b6604b5c5ef92e44b065267a68279bfa57ef78d0eb76960bf233a2721e23eae7260e9c
7
+ data.tar.gz: f6532a9558d78a8c715020bc42445f05c879d66b668969d32921e6d64585dd78683002e560fe5c82252e24ad9f9d0ccf0264a780603bc4582b48f0514125605c
@@ -1,4 +1,4 @@
1
- module HealthMonitor
1
+ module HealthMonitorLb
2
2
  class ApplicationController < ActionController::API
3
3
  before_action :check_api_token
4
4
 
@@ -1,4 +1,4 @@
1
- module HealthMonitor
1
+ module HealthMonitorLb
2
2
  class HealthController < ApplicationController
3
3
  def index
4
4
  status = HealthCheckService.new.call
@@ -1,4 +1,4 @@
1
- module HealthMonitor
1
+ module HealthMonitorLb
2
2
  class HealthCheckService
3
3
  def call
4
4
  status = { rails_version: Rails::VERSION::STRING }
@@ -6,7 +6,7 @@ module HealthMonitor
6
6
  .merge(postgres_check)
7
7
  .merge(redis_check)
8
8
 
9
- HealthMonitor.additional_health_checks.each do |health_check_klass|
9
+ HealthMonitorLb.additional_health_checks.each do |health_check_klass|
10
10
  status = status.merge(health_check_klass.safe_constantize.health_check)
11
11
  end
12
12
 
data/bin/rails CHANGED
@@ -3,7 +3,7 @@
3
3
  # installed from the root of your application.
4
4
 
5
5
  ENGINE_ROOT = File.expand_path('..', __dir__)
6
- ENGINE_PATH = File.expand_path('../lib/health_monitor/engine', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/health_monitor_lb/engine', __dir__)
7
7
  APP_PATH = File.expand_path('../spec/dummy/config/application', __dir__)
8
8
 
9
9
  # Set up gems listed in the Gemfile.
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
- HealthMonitor::Engine.routes.draw do
1
+ HealthMonitorLb::Engine.routes.draw do
2
2
  get '/health' => 'health#index'
3
3
  end
@@ -0,0 +1,5 @@
1
+ module HealthMonitorLb
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace HealthMonitorLb
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module HealthMonitorLb
2
+ VERSION = '1.1.0'.freeze
3
+ end
@@ -1,7 +1,7 @@
1
- require "health_monitor/version"
2
- require "health_monitor/engine"
1
+ require "health_monitor_lb/version"
2
+ require "health_monitor_lb/engine"
3
3
 
4
- module HealthMonitor
4
+ module HealthMonitorLb
5
5
  mattr_accessor :additional_health_checks
6
6
  @@additional_health_checks = []
7
7
 
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- module HealthControllerSpec
3
+ module HealthControllerLbSpec
4
4
  class TestHealthCheck
5
5
  def self.health_check
6
6
  { 'test_health_check' => 'ok' }
@@ -8,8 +8,8 @@ module HealthControllerSpec
8
8
  end
9
9
  end
10
10
 
11
- describe HealthMonitor::HealthController, type: :controller do
12
- routes { HealthMonitor::Engine.routes }
11
+ describe HealthMonitorLb::HealthController, type: :controller do
12
+ routes { HealthMonitorLb::Engine.routes }
13
13
 
14
14
  context 'not authorized' do
15
15
  it 'returns unauthorized without a token' do
@@ -27,14 +27,14 @@ describe HealthMonitor::HealthController, type: :controller do
27
27
  end
28
28
 
29
29
  it 'handles custom checks' do
30
- HealthMonitor.additional_health_checks = ['HealthControllerSpec::TestHealthCheck']
30
+ HealthMonitorLb.additional_health_checks = ['HealthControllerLbSpec::TestHealthCheck']
31
31
 
32
32
  get :index, params: { API_TOKEN: ENV['HEALTH_MONITOR_API_TOKEN'] }
33
33
  expect(response.status).to eq(200)
34
34
 
35
35
  expect(response.parsed_body).to include({ 'rails_version' => Rails::VERSION::STRING, 'ruby' => 'ok', 'test_health_check' => 'ok' })
36
36
 
37
- HealthMonitor.additional_health_checks = []
37
+ HealthMonitorLb.additional_health_checks = []
38
38
  end
39
39
  end
40
40
  end
@@ -5,7 +5,7 @@ require "rails/all"
5
5
  # Require the gems listed in Gemfile, including any gems
6
6
  # you've limited to :test, :development, or :production.
7
7
  Bundler.require(*Rails.groups)
8
- require "health_monitor"
8
+ require "health_monitor_lb"
9
9
 
10
10
  module Dummy
11
11
  class Application < Rails::Application
@@ -1,3 +1,3 @@
1
1
  Rails.application.routes.draw do
2
- mount HealthMonitor::Engine => '/'
2
+ mount HealthMonitorLb::Engine => '/'
3
3
  end
@@ -182,3 +182,30 @@ Completed 200 OK in 94ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 386)
182
182
  Processing by HealthMonitor::HealthController#index as HTML
183
183
  Parameters: {"API_TOKEN"=>"[FILTERED]"}
184
184
  Completed 200 OK in 93ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 184)
185
+ Processing by HealthMonitorLb::HealthController#index as HTML
186
+ Filter chain halted as :check_api_token rendered or redirected
187
+ Completed 401 Unauthorized in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 282)
188
+ Processing by HealthMonitorLb::HealthController#index as HTML
189
+ Parameters: {"API_TOKEN"=>"[FILTERED]"}
190
+ Completed 500 Internal Server Error in 109ms (ActiveRecord: 0.0ms | Allocations: 355)
191
+ Processing by HealthMonitorLb::HealthController#index as HTML
192
+ Parameters: {"API_TOKEN"=>"[FILTERED]"}
193
+ Completed 500 Internal Server Error in 107ms (ActiveRecord: 0.0ms | Allocations: 153)
194
+ Processing by HealthMonitorLb::HealthController#index as HTML
195
+ Filter chain halted as :check_api_token rendered or redirected
196
+ Completed 401 Unauthorized in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 282)
197
+ Processing by HealthMonitorLb::HealthController#index as HTML
198
+ Parameters: {"API_TOKEN"=>"[FILTERED]"}
199
+ Completed 200 OK in 98ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 385)
200
+ Processing by HealthMonitorLb::HealthController#index as HTML
201
+ Parameters: {"API_TOKEN"=>"[FILTERED]"}
202
+ Completed 500 Internal Server Error in 98ms (ActiveRecord: 0.0ms | Allocations: 208)
203
+ Processing by HealthMonitorLb::HealthController#index as HTML
204
+ Filter chain halted as :check_api_token rendered or redirected
205
+ Completed 401 Unauthorized in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 282)
206
+ Processing by HealthMonitorLb::HealthController#index as HTML
207
+ Parameters: {"API_TOKEN"=>"[FILTERED]"}
208
+ Completed 200 OK in 112ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 385)
209
+ Processing by HealthMonitorLb::HealthController#index as HTML
210
+ Parameters: {"API_TOKEN"=>"[FILTERED]"}
211
+ Completed 200 OK in 106ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 185)
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
  require "rails_helper"
3
3
 
4
- RSpec.describe HealthMonitor do
4
+ RSpec.describe HealthMonitorLb do
5
5
  it "has a version number" do
6
- expect(HealthMonitor::VERSION).not_to be nil
6
+ expect(HealthMonitorLb::VERSION).not_to be nil
7
7
  end
8
8
  end
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,7 @@ require 'rspec/rails'
8
8
  require 'nulldb_rspec'
9
9
  include NullDB::RSpec::NullifiedDatabase
10
10
 
11
- require "health_monitor"
11
+ require "health_monitor_lb"
12
12
 
13
13
  RSpec.configure do |config|
14
14
  # Enable flags like --only-failures and --next-failure
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health_monitor_lb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan Hecht
@@ -93,16 +93,15 @@ extra_rdoc_files: []
93
93
  files:
94
94
  - README.md
95
95
  - Rakefile
96
- - app/controllers/health_monitor/application_controller.rb
97
- - app/controllers/health_monitor/health_controller.rb
98
- - app/services/health_monitor/health_check_service.rb
96
+ - app/controllers/health_monitor_lb/application_controller.rb
97
+ - app/controllers/health_monitor_lb/health_controller.rb
98
+ - app/services/health_monitor_lb/health_check_service.rb
99
99
  - bin/rails
100
100
  - config/routes.rb
101
- - lib/health_monitor.rb
102
- - lib/health_monitor/engine.rb
103
- - lib/health_monitor/version.rb
104
- - lib/tasks/health_monitor_tasks.rake
105
- - spec/controllers/health_monitor/health_controller_spec.rb
101
+ - lib/health_monitor_lb.rb
102
+ - lib/health_monitor_lb/engine.rb
103
+ - lib/health_monitor_lb/version.rb
104
+ - spec/controllers/health_monitor_lb/health_controller_lb_spec.rb
106
105
  - spec/dummy/Rakefile
107
106
  - spec/dummy/app/assets/config/manifest.js
108
107
  - spec/dummy/app/assets/stylesheets/application.css
@@ -152,7 +151,7 @@ files:
152
151
  - spec/dummy/public/apple-touch-icon.png
153
152
  - spec/dummy/public/favicon.ico
154
153
  - spec/dummy/tmp/development_secret.txt
155
- - spec/health_monitor_spec.rb
154
+ - spec/health_monitor_lb_spec.rb
156
155
  - spec/rails_helper.rb
157
156
  - spec/spec_helper.rb
158
157
  licenses:
@@ -1,5 +0,0 @@
1
- module HealthMonitor
2
- class Engine < ::Rails::Engine
3
- isolate_namespace HealthMonitor
4
- end
5
- end
@@ -1,3 +0,0 @@
1
- module HealthMonitor
2
- VERSION = '1.0.0'.freeze
3
- end
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :health_monitor do
3
- # # Task goes here
4
- # end