crons only

This commit is contained in:
carlad 2016-07-25 19:30:45 +02:00
parent 5e798aca6f
commit c00cdbaff7
4 changed files with 17 additions and 24 deletions

View File

@ -31,7 +31,7 @@ module Travis::API::V3
::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
Raven.capture_exception(e)
end
end
end

View File

@ -37,7 +37,6 @@ module Travis::API::V3
metrics.success(status: response[0])
response
rescue Error => error
Raven.capture_exception(error)
metrics.tick(:service)
result = Result.new(access_control, :error, error)

View File

@ -9,25 +9,3 @@ describe Travis::API::V3::ServiceIndex, set_app: true do
response.status.should == 405
end
end
describe Travis::API::V3::Router, set_app: true do
include Rack::Test::Methods
class TestError < StandardError; end
before do
set_app Raven::Rack.new(app)
Travis.config.sentry.dsn = "test"
Travis::Api::App.setup_monitoring
end
it 'Sentry captures router errors' do
error = TestError.new('Konstantin broke all the thingz!')
Travis::API::V3::Models::Repository.any_instance.stubs(:service).raises(error)
Raven.expects(:send_event).with do |event|
event.message == "#{error.class}: #{error.message}"
end
expect { get "/v3/repo/1" }.to raise_error(TestError)
sleep 0.1
end
end

View File

@ -22,4 +22,20 @@ describe Travis::API::V3::Queries::Crons do
end
end
#TODO - mock any instance of cron branch (line 15) - cron branch re
# Travis::API::V3::Models::Cron.any_instance.stubs(:branch).raises(error)
# describe Travis::API::V3::Router, set_app: true do
#
# it 'Sentry captures router errors' do
# error = StandardError.new('Konstantin broke all the thingz!')
# Travis::API::V3::Services::Repository::Find.any_instance.stubs(:run!).raises(error)
# Raven.expects(:capture_exception).with do |event|
# event.message == "#{error.class}: #{error.message}"
# end
# expect { get "/v3/repo/1" }.to raise_error(error)
# end
# end
end