Skip to content

Commit

Permalink
Fix health check controller, also add basic controller tests and cove…
Browse files Browse the repository at this point in the history
…rage tool
  • Loading branch information
jsuchal committed Dec 6, 2023
1 parent fcd5008 commit 0274bbb
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ yarn-debug.log*
!/app/assets/builds/.keep

.DS_Store

coverage

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ group :test do
gem 'capybara'
gem 'capybara-screenshot'
gem 'webmock'
gem 'simplecov', require: false
end
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ GEM
irb (>= 1.5.0)
reline (>= 0.3.1)
diff-lcs (1.5.0)
docile (1.4.0)
domain_name (0.6.20231109)
dotenv (2.8.1)
dotenv-rails (2.8.1)
Expand Down Expand Up @@ -388,6 +389,12 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
snaky_hash (2.0.1)
hashie
Expand Down Expand Up @@ -506,6 +513,7 @@ DEPENDENCIES
ruby-lsp-rails
rubyzip
selenium-webdriver
simplecov
solargraph
sprockets-rails
stimulus-rails
Expand Down
1 change: 0 additions & 1 deletion app/controllers/health_check_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
class HealthCheckController < ApplicationController
skip_before_action :authenticate
skip_after_action :verify_authorized
skip_after_action :verify_policy_scoped
skip_before_action :set_menu_context

def show
Expand Down
21 changes: 21 additions & 0 deletions test/integration/health_check_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "test_helper"

class HealthCheckTest < ActionDispatch::IntegrationTest
test "healthcheck responds with 200 OK" do
get '/health/'

assert_response :success
end

test "failing jobs healthcheck responds with 200 OK" do
get '/health/jobs/failing'

assert_response :success
end

test "stuck jobs healthcheck responds with 200 OK" do
get '/health/jobs/stuck'

assert_response :success
end
end
3 changes: 3 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require 'simplecov'
SimpleCov.start 'rails'

ENV['RAILS_ENV'] ||= 'test'
require_relative "../config/environment"
require "rails/test_help"
Expand Down

0 comments on commit 0274bbb

Please sign in to comment.