Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Pass a build if it is aborted and all of its parts succeed #73

Merged
merged 3 commits into from
May 15, 2014

Conversation

robolson
Copy link
Collaborator

I want to avoid the confusing situation where a build is aborted after all of its build attempts have started and those build attempts go on to succeed but the build remains in the aborted state. With this change, a build will switch for aborted to succeeded in that situation.

@cheister @squarenerd

Rewrote to call no other methods besides the one under test making it a
more pure unit test.
Fixes an unexpected outcome where a build is marked as aborted even if
all of its build parts have passed. This can happen if a build is
aborted after all of its build attempts already started executing and
those build attempts all go on to pass.
@squarenerd
Copy link
Contributor

Clean code! LGTM.

@@ -104,8 +106,8 @@ def update_state_from_parts!
end

previous_state = self.state
update_attributes!(:state => state)
[previous_state, state]
update_attributes!(:state => next_state) unless previous_state == next_state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a big deal, but wouldn't rails dirty tracking give you the "unless" for free?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had thought so too but I tested it in console and an UPDATE still occurred. I tried both updated_attributes! and save!.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, there's probably something unusual here, or something I don't understand, but it doesn't seem necessary to figure it out.

@jkingdon
Copy link
Contributor

Looks good to me.

robolson added a commit that referenced this pull request May 15, 2014
Pass a build if it is aborted and all of its parts succeed

R: squarenerd jkingdon
@robolson robolson merged commit 5059d2b into master May 15, 2014
@robolson robolson deleted the rob/limit-aborts branch May 15, 2014 16:00
robolson added a commit that referenced this pull request Oct 29, 2015
* commit '8e4103811f5b98ee677cb91d0602dac1b24deaf3':
  SqFork: Move all background jobs to be monitored by runit
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants