-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve in-progress builds when reloading a job. Because in-flight builds tend to update the state a lot, with this change we refrain from reloading those builds from the disk. This should be acceptable since we are primarily reloading a job, and reloading of builds are secondary.
- Loading branch information
Showing
6 changed files
with
104 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package hudson.model | ||
|
||
import org.jvnet.hudson.test.Bug | ||
import org.jvnet.hudson.test.HudsonTestCase | ||
import org.jvnet.hudson.test.SleepBuilder | ||
|
||
import javax.xml.transform.stream.StreamSource | ||
|
||
/** | ||
* | ||
* | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
class RunMapTest extends HudsonTestCase { | ||
/** | ||
* Makes sure that reloading the project while a build is in progress won't clobber that in-progress build. | ||
*/ | ||
@Bug(12318) | ||
public void testReloadWhileBuildIsInProgress() { | ||
def p = createFreeStyleProject() | ||
|
||
// want some completed build records | ||
def b1 = assertBuildStatusSuccess(p.scheduleBuild2(0)) | ||
|
||
// now create a build that hangs until we signal the OneShotEvent | ||
p.buildersList.add(new SleepBuilder(9999999)); | ||
def b2 = p.scheduleBuild2(0).waitForStart() | ||
assertEquals 2,b2.number | ||
|
||
// now reload | ||
p.updateByXml(new StreamSource(p.configFile.file)) | ||
|
||
// we should still see the same object for #2 because that's in progress | ||
assertSame p.getBuildByNumber(b2.number),b2 | ||
// build #1 should be reloaded | ||
assertNotSame b1,p.getBuildByNumber(1) | ||
|
||
// and reference gets fixed up | ||
b1 = p.getBuildByNumber(1) | ||
assertSame b1.nextBuild,b2 | ||
assertSame b2.previousBuild,b1 | ||
} | ||
} |