Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add check for single bad build #93

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/travis/hub/service/update_build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class UpdateBuild < Struct.new(:event, :data)

def run
exclusive do
p data[:id]
return if data[:id].to_i == 187764488
validate
update_jobs
notify
Expand Down
14 changes: 14 additions & 0 deletions spec/travis/hub/service/update_build_spec.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
describe Travis::Hub::Service::UpdateBuild do
let(:now) { Time.now }
let(:build) { FactoryGirl.create(:build, jobs: [job], state: state, received_at: now - 10) }
let(:bad_build) { FactoryGirl.create(:build, id: 187764488, jobs: [job], state: state, received_at: now - 10) }
let(:job) { FactoryGirl.create(:job, state: state) }
let(:amqp) { Travis::Amqp.any_instance }

subject { described_class.new(context, event, data) }
before { amqp.stubs(:fanout) }

# special check to enable cancelation of build with massive matrix
describe 'special case - specific build' do
let(:state) { :created }
let(:event) { :start }
let(:data) { { id: bad_build.id, started_at: now } }

it 'ignores a specific build' do
puts bad_build.id
subject.run
expect(bad_build.reload.state).to eql(:created)
end
end

describe 'start event' do
let(:state) { :created }
let(:event) { :start }
Expand Down