Merge pull request #303 from travis-ci/cd-sentry
Send error logging to Sentry
This commit is contained in:
commit
93cfcadeef
|
@ -9,6 +9,8 @@ module Travis::API::V3
|
|||
Models::Cron.all.select do |cron|
|
||||
start(cron) if cron.next_enqueuing <= Time.now
|
||||
end
|
||||
rescue => e
|
||||
Raven.capture_exception(e)
|
||||
end
|
||||
|
||||
def start(cron)
|
||||
|
@ -30,8 +32,6 @@ module Travis::API::V3
|
|||
class_name, queue = Query.sidekiq_queue(:build_request)
|
||||
::Sidekiq::Client.push('queue'.freeze => queue, 'class'.freeze => class_name, 'args'.freeze => [{type: 'cron'.freeze, payload: JSON.dump(payload), credentials: {}}])
|
||||
true
|
||||
rescue => e
|
||||
puts e.message, e.backtrace
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,7 +18,6 @@ module Travis::API::V3
|
|||
env_params = params(env)
|
||||
factory, params = routes.factory_for(env['REQUEST_METHOD'.freeze], env['PATH_INFO'.freeze])
|
||||
|
||||
|
||||
raise NotFound unless factory
|
||||
metrics.name_after(factory)
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@ describe Travis::API::V3::ServiceIndex, set_app: true do
|
|||
let(:resources) { json.fetch('resources') }
|
||||
|
||||
it "handles wrong HTTP method with 405 status" do
|
||||
|
||||
response.status.should == 405
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'sentry-raven'
|
||||
|
||||
describe Travis::API::V3::Queries::Crons do
|
||||
let(:user) { Travis::API::V3::Models::User.find_by_login('svenfuchs') }
|
||||
let(:repo) { Travis::API::V3::Models::Repository.where(owner_name: 'svenfuchs', name: 'minimal').first }
|
||||
|
@ -12,7 +14,6 @@ describe Travis::API::V3::Queries::Crons do
|
|||
it "starts crons on existing branches" do
|
||||
cron = Travis::API::V3::Models::Cron.create(branch_id: existing_branch.id, interval: 'daily', disable_by_build: false)
|
||||
expect(query.start_all).to include(cron)
|
||||
|
||||
end
|
||||
|
||||
it "delete crons on branches not existing on GitHub" do
|
||||
|
@ -20,6 +21,13 @@ describe Travis::API::V3::Queries::Crons do
|
|||
expect(query.start_all).to_not include(cron)
|
||||
expect(Travis::API::V3::Models::Cron.where(id: cron.id).length).to equal(0)
|
||||
end
|
||||
end
|
||||
|
||||
it 'enques error into a thread' do
|
||||
cron = Travis::API::V3::Models::Cron.create(branch_id: existing_branch.id, interval: 'daily', disable_by_build: false)
|
||||
error = StandardError.new('Konstantin broke all the thingz!')
|
||||
Travis::API::V3::Models::Cron.any_instance.stubs(:branch).raises(error)
|
||||
Raven.expects(:capture_exception).with(error)
|
||||
query.start_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user