-
Notifications
You must be signed in to change notification settings - Fork 111
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
Removing AbstractFolder.delete
override
#356
Changes from all commits
95993bd
8a37aec
e470a76
28e732e
0fffcc2
ddafc43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,8 +39,13 @@ | |
import hudson.model.Item; | ||
import hudson.model.Job; | ||
import hudson.model.ListView; | ||
import hudson.model.ParametersDefinitionProperty; | ||
import hudson.model.Queue; | ||
import hudson.model.Result; | ||
import hudson.model.StringParameterDefinition; | ||
import hudson.model.User; | ||
import hudson.model.listeners.ItemListener; | ||
import hudson.model.queue.QueueTaskFuture; | ||
import hudson.search.SearchItem; | ||
import hudson.security.ACL; | ||
import hudson.security.ACLContext; | ||
|
@@ -81,8 +86,10 @@ | |
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
|
||
import org.junit.ClassRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.BuildWatcher; | ||
import org.jvnet.hudson.test.Issue; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
import org.jvnet.hudson.test.MockAuthorizationStrategy; | ||
|
@@ -93,6 +100,7 @@ | |
public class FolderTest { | ||
|
||
@Rule public JenkinsRule r = new JenkinsRule(); | ||
@ClassRule public static BuildWatcher bw = new BuildWatcher(); | ||
|
||
/** | ||
* Tests rename operation. | ||
|
@@ -225,6 +233,27 @@ | |
} | ||
} | ||
|
||
@Issue("JENKINS-35160") | ||
@Test | ||
public void interruptOnDelete() throws Exception { | ||
// adapted from JobTest in core | ||
r.jenkins.setNumExecutors(2); | ||
Queue.getInstance().maintain(); | ||
Folder d = r.createProject(Folder.class, "d"); | ||
FreeStyleProject p = d.createProject(FreeStyleProject.class, "p"); | ||
p.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("dummy", "0"))); | ||
p.setConcurrentBuild(true); | ||
p.getBuildersList().add(new SleepBuilder(Long.MAX_VALUE)); | ||
FreeStyleBuild build1 = p.scheduleBuild2(0).getStartCondition().get(); | ||
FreeStyleBuild build2 = p.scheduleBuild2(0).getStartCondition().get(); | ||
QueueTaskFuture<FreeStyleBuild> build3 = p.scheduleBuild2(0); | ||
Thread.sleep(1000); // TODO Queue.cancel(Item) can return false immediately after scheduling | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
d.delete(); | ||
r.assertBuildStatus(Result.ABORTED, r.waitForCompletion(build1)); | ||
r.assertBuildStatus(Result.ABORTED, r.waitForCompletion(build2)); | ||
assertTrue(build3.isCancelled()); | ||
Comment on lines
+252
to
+254
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually this passes even with |
||
} | ||
|
||
/** | ||
* This is more of a test of the core, but make sure the triggers resolve between ourselves. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet in an LTS version of course. I have no strong opinion as to whether we should wait for that or not.