mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Clean up the test checks when done
This commit is contained in:
parent
3cbfc45bf6
commit
65790452d8
@ -33,9 +33,6 @@ class AdminDashboardData
|
||||
MOBILE_REPORTS ||= ['mobile_visits'] + ApplicationRequest.req_types.keys.select {|r| r =~ /mobile/}.map { |r| r + "_reqs" }
|
||||
|
||||
def self.add_problem_check(*syms, &blk)
|
||||
@problem_syms ||= []
|
||||
@problem_blocks ||= []
|
||||
|
||||
@problem_syms.push(*syms) if syms
|
||||
@problem_blocks << blk if blk
|
||||
end
|
||||
@ -52,6 +49,11 @@ class AdminDashboardData
|
||||
problems.compact
|
||||
end
|
||||
|
||||
# used for testing
|
||||
def self.reset_problem_checks
|
||||
@problem_syms = []
|
||||
@problem_blocks = []
|
||||
|
||||
add_problem_check :rails_env_check, :ruby_version_check, :host_names_check,
|
||||
:gc_checks, :ram_check, :google_oauth2_config_check,
|
||||
:facebook_config_check, :twitter_config_check,
|
||||
@ -64,7 +66,8 @@ class AdminDashboardData
|
||||
add_problem_check do
|
||||
sidekiq_check || queue_size_check
|
||||
end
|
||||
|
||||
end
|
||||
reset_problem_checks
|
||||
|
||||
def self.fetch_stats
|
||||
AdminDashboardData.new.as_json
|
||||
|
@ -3,6 +3,10 @@ require 'spec_helper'
|
||||
describe AdminDashboardData do
|
||||
|
||||
describe "adding new checks" do
|
||||
after do
|
||||
AdminDashboardData.reset_problem_checks
|
||||
end
|
||||
|
||||
it 'calls the passed block' do
|
||||
called = false
|
||||
AdminDashboardData.add_problem_check do
|
||||
|
Loading…
Reference in New Issue
Block a user