-
Notifications
You must be signed in to change notification settings - Fork 128
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
Better fix of timeout
activity tick after restart
#234
Changes from 1 commit
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 |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
import java.util.List; | ||
import java.util.Set; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.logging.Level; | ||
import jenkins.model.CauseOfInterruption; | ||
import jenkins.model.InterruptedBuildAction; | ||
import jenkins.plugins.git.GitSampleRepoRule; | ||
|
@@ -59,6 +60,7 @@ | |
import org.jvnet.hudson.test.BuildWatcher; | ||
import org.jvnet.hudson.test.Issue; | ||
import org.jvnet.hudson.test.JenkinsSessionRule; | ||
import org.jvnet.hudson.test.LoggerRule; | ||
import org.jvnet.hudson.test.TestExtension; | ||
import org.jvnet.hudson.test.recipes.LocalData; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
@@ -71,6 +73,8 @@ public class TimeoutStepTest { | |
|
||
@Rule public GitSampleRepoRule git = new GitSampleRepoRule(); | ||
|
||
@Rule public LoggerRule logging = new LoggerRule().record(TimeoutStepExecution.class, Level.FINE); | ||
|
||
@Test public void configRoundTrip() throws Throwable { | ||
sessions.then(j -> { | ||
TimeoutStep s1 = new TimeoutStep(3); | ||
|
@@ -212,13 +216,14 @@ public void activityRestart() throws Throwable { | |
+ " echo 'NotHereYet';\n" | ||
+ " sleep 10;\n" | ||
+ " echo 'JustHere!';\n" | ||
+ " sleep 30;\n" | ||
+ " sleep 20;\n" | ||
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. A pre-commit version the main patch contained a mistake—the build did not time out until 1½× the stated period; in this case |
||
+ " echo 'ShouldNot!';\n" | ||
+ " }\n" | ||
+ "}\n", true)); | ||
WorkflowRun b = p.scheduleBuild2(0).getStartCondition().get(); | ||
SemaphoreStep.waitForStart("restarted/1", b); | ||
}); | ||
Thread.sleep(10_000); // restarting should count as activity | ||
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. Making the test reliably reproduce the originally reported problem. |
||
sessions.then(j -> { | ||
WorkflowJob p = j.jenkins.getItemByFullName("restarted", WorkflowJob.class); | ||
WorkflowRun b = p.getBuildByNumber(1); | ||
|
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.
Just to help debug.