-
Notifications
You must be signed in to change notification settings - Fork 66
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
Bump parent pom to 3.54 #99
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
31 changes: 31 additions & 0 deletions
31
src/test/java/org/jenkinsci/plugins/workflow/test/steps/SemaphoreStepTest.java
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,31 @@ | ||
package org.jenkinsci.plugins.workflow.test.steps; | ||
|
||
import hudson.model.Result; | ||
import hudson.model.queue.QueueTaskFuture; | ||
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition; | ||
import org.jenkinsci.plugins.workflow.job.WorkflowJob; | ||
import org.jenkinsci.plugins.workflow.job.WorkflowRun; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
|
||
public class SemaphoreStepTest { | ||
@Rule | ||
public JenkinsRule j = new JenkinsRule(); | ||
|
||
@Test | ||
public void hardKill() throws Exception { | ||
WorkflowJob p1 = j.jenkins.createProject(WorkflowJob.class, "p"); | ||
p1.setDefinition(new CpsFlowDefinition("echo 'locked!'; semaphore 'wait'")); | ||
QueueTaskFuture<WorkflowRun> future = p1.scheduleBuild2(0); | ||
assertNotNull(future); | ||
WorkflowRun b = future.waitForStart(); | ||
SemaphoreStep.waitForStart("wait/1", b); | ||
|
||
b.doKill(); | ||
j.waitForMessage("Hard kill!", b); | ||
j.assertBuildStatus(Result.ABORTED, future); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is the problem that this test is reproducing? Did it hang forever with older implementations of
WorkflowRun.doKill
or something?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.
Please, look at jenkinsci/lockable-resources-plugin#170.
They have issues with upgrading to modern JTH,
LockStepHardKillTest
leaves open file descriptors after test ends and this is detected by jenkinsci/jenkins-test-harness#166.However, this failure isn't related to lockable-resources-plugin at all, it is local to workflow-support-plugin + workflow-api. That's why I am creating a test here that is a stripped-down version of LockStepHardKillTest demonstrating the same issue.
Note that issue cannot be detected by JMH without upgrading parent POM, that's why I put these changes together.
You may see how this test fails without workflow-api upgrade in build 3 of current PR.
Overall, I'm currently walking through different Jenkins plugins and updating parent pom to 3.54 (you've seen some of my PRs already). Some plugins update cleanly, some encounter different issues related to jenkinsci/jenkins-test-harness#166.
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.
Ok, so if I understand correctly, the problem is that older versions of workflow-api leave the log file opened in some cases (I guess related to the bugs fixed in versions 2.31, 2.32, and 2.33 of that plugin), which causes test failures on Windows because the temp directories for the tests can't be deleted? I'm just confused why workflow-support has anything to do with it, since you didn't update any code related to
SemaphoreStep
here, I would think you could see the same problem withwaitUntil
or maybe evensleep
.You should be able to update the version of
workflow-api
that lockable-resources depends on (right now it picks up an old version through the workflow-support dependency). From a quick look at the APIs it is using, I think that it would make more sense for lockable-resources to only depend on workflow-step-api and workflow-api in compile scope, and move the workflow-support non-tests-classifier dependency to test scope.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.
(Adding the test here is fine, thanks for adding it! I just don't think it matters for lockable-resources)
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.
Right. Newer parent pom brings in newer JTH. Newer JTH is smart enough to detect a bug in older workflow-api versions. This bug can be demonstrated by a (useful, IMO) test that terminates build during semaphore step. lockable-resources have such test. workflow-support-plugin doesn't (until this PR). Fixing it requires updating dependency on workflow-api. And that's what I am doing here.
I do not say that this PR is a prerequisite to fix lockable-resources, they have other options to go.
Yes, though semaphore is more deterministic (no hardcoded timeouts and stuff like that).