Skip to content

Commit

Permalink
Stop build in `DeleteBuildsCommandTest.deleteBuildsShouldFailIfTheBui…
Browse files Browse the repository at this point in the history
…ldIsRunning` so test can be cleaned up on Windows consistently (#9876)
  • Loading branch information
dwnusbaum authored Oct 15, 2024
1 parent c41791e commit 5019eb9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/src/test/java/hudson/cli/DeleteBuildsCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import hudson.model.ExecutorTest;
import hudson.model.FreeStyleProject;
import hudson.model.Item;
import hudson.model.Result;
import hudson.model.Run;
import hudson.model.labels.LabelAtom;
import hudson.tasks.Shell;
Expand Down Expand Up @@ -139,7 +140,7 @@ public class DeleteBuildsCommandTest {
@Issue("JENKINS-73835")
@Test public void deleteBuildsShouldFailIfTheBuildIsRunning() throws Exception {
FreeStyleProject project = j.createFreeStyleProject("aProject");
ExecutorTest.startBlockingBuild(project);
var build = ExecutorTest.startBlockingBuild(project);
assertThat(((FreeStyleProject) j.jenkins.getItem("aProject")).getBuilds(), hasSize(1));

final CLICommandInvoker.Result result = command
Expand All @@ -148,6 +149,9 @@ public class DeleteBuildsCommandTest {
assertThat(result, failedWith(1));
assertThat(result, hasNoStandardOutput());
assertThat(result.stderr(), containsString("Unable to delete aProject #1 because it is still running"));

build.doStop();
j.assertBuildStatus(Result.ABORTED, j.waitForCompletion(build));
}

@Test public void deleteBuildsShouldSuccessEvenTheBuildIsStuckInTheQueue() throws Exception {
Expand Down

0 comments on commit 5019eb9

Please sign in to comment.