Merge branch 'ar-remove-unused-core-code' of github.com:travis-ci/travis-api into ar-remove-unused-core-code
This commit is contained in:
commit
89eea1682f
|
@ -96,6 +96,7 @@ PATH
|
|||
simple_states (~> 1.0.0)
|
||||
sinatra (~> 1.3)
|
||||
sinatra-contrib (~> 1.3)
|
||||
tool
|
||||
travis-support
|
||||
useragent
|
||||
virtus (~> 1.0.0)
|
||||
|
|
|
@ -77,5 +77,4 @@ If you have problems with Nginx because the websocket is already in use, try res
|
|||
|
||||
### API documentation
|
||||
|
||||
We use source code comments to add documentation. If the server is running, you
|
||||
can browse an HTML documentation at [`/docs`](http://localhost:5000/docs).
|
||||
v3 documentation can be found at https://developer.travis-ci.org which is a repository that can be found at https://github.com/travis-pro/developer
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency 'rack-contrib', '~> 1.1'
|
||||
s.add_dependency 'memcachier'
|
||||
s.add_dependency 'useragent'
|
||||
s.add_dependency 'tool'
|
||||
|
||||
# from travis-core gemspec
|
||||
|
||||
|
@ -36,4 +37,3 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency 'multi_json'
|
||||
s.add_dependency 'google-api-client', '~> 0.9.4'
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user