Skip to content

Commit

Permalink
[JENKINS-25889] Ameliorated by reducing to a warning. Not a full fix.
Browse files Browse the repository at this point in the history
Originally-Committed-As: 48ec7487f8b148e366c2ec9827c412b047eca651
  • Loading branch information
jglick committed Nov 17, 2015
1 parent 2c8b03e commit 5cc9b91
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Expand Up @@ -24,42 +24,33 @@

package org.jenkinsci.plugins.workflow.steps.input;

import com.google.common.base.Function;
import java.io.IOException;
import org.jenkinsci.plugins.workflow.SingleJobTestBase;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.steps.StepExecution;
import org.jenkinsci.plugins.workflow.support.steps.input.InputStepExecution;
import org.jenkinsci.plugins.workflow.support.steps.input.InputAction;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runners.model.Statement;
import org.jvnet.hudson.test.Issue;

public class InputStepRestartTest extends SingleJobTestBase {

@Issue("JENKINS-25889")
@Test public void restart() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
p = jenkins().createProject(WorkflowJob.class, "demo");
p.setDefinition(new CpsFlowDefinition("input 'paused'"));
startBuilding();
waitForWorkflowToSuspend();
assertTrue(b.isBuilding());
story.j.waitForMessage("paused", b);
}
});
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
rebuildContext(story.j);
assertThatWorkflowIsSuspended();
StepExecution.applyAll(InputStepExecution.class, new Function<InputStepExecution,Void>() {
@Override public Void apply(InputStepExecution exec) {
try {
exec.doProceedEmpty();
} catch (IOException x) {
assert false : x;
}
return null;
}
}).get();
InputAction a = b.getAction(InputAction.class);
assertEquals(1, a.getExecutions().size());
story.j.submit(story.j.createWebClient().getPage(b, a.getUrlName()).getFormByName(a.getExecutions().get(0).getId()), "proceed");
story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b));
}
});
Expand Down
Expand Up @@ -33,12 +33,17 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException;

/**
* @author Kohsuke Kawaguchi
*/
public class InputStepExecution extends AbstractStepExecutionImpl implements ModelObject {

private static final Logger LOGGER = Logger.getLogger(InputStepExecution.class.getName());

/**
* Pause gets added here.
*/
Expand Down Expand Up @@ -225,7 +230,11 @@ private void postSettlement() throws IOException {
getPauseAction().remove(this);
run.save();
} finally {
PauseAction.endCurrentPause(node);
if (node != null) {
PauseAction.endCurrentPause(node);
} else {
LOGGER.log(Level.WARNING, "cannot set pause end time for {0} in {1}", new Object[] {getId(), run});
}
}
}

Expand Down

0 comments on commit 5cc9b91

Please sign in to comment.