Navigation Menu

Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
[JENKINS-26137] At least during restarting tests, serialization error…
Browse files Browse the repository at this point in the history
…s seem to be due to there being no PickleFactory’s installed.

Merely calling PickleFactory.all() from the RiverWriter constructor, rather than later, seems to let PushdStepTest.restarting pass (JENKINS-26051).
Additionally asserting that there are in fact some factories loaded, since there is sure to be trouble if there are not.
Also need to wait for the build to finish (JENKINS-26399).
  • Loading branch information
jglick committed Jan 12, 2015
1 parent cfdb2e1 commit 3d3fa34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Expand Up @@ -28,7 +28,6 @@
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.Rule;
import org.junit.runners.model.Statement;
Expand All @@ -48,7 +47,6 @@ public class PushdStepTest {
});
}

@Ignore("TODO as per JENKINS-26149 PushdStep.Execution.step might need to be optional=true, but cannot get this test to pass because of JENKINS-26137")
@Test public void restarting() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
Expand All @@ -62,6 +60,9 @@ public class PushdStepTest {
@Override public void evaluate() throws Throwable {
SemaphoreStep.success("restarting/1", null);
WorkflowRun b = story.j.jenkins.getItemByFullName("p", WorkflowJob.class).getLastBuild();
while (b.isBuilding()) { // TODO JENKINS-26399
Thread.sleep(100);
}
story.j.assertLogContains("/subdir", story.j.assertBuildStatusSuccess(b));
}
});
Expand Down
Expand Up @@ -28,6 +28,7 @@
import org.jenkinsci.plugins.workflow.pickles.Pickle;
import org.jenkinsci.plugins.workflow.pickles.PickleFactory;
import com.trilead.ssh2.util.IOUtils;
import hudson.ExtensionList;
import org.jboss.marshalling.Marshaller;
import org.jboss.marshalling.Marshalling;
import org.jboss.marshalling.MarshallingConfiguration;
Expand Down Expand Up @@ -87,6 +88,10 @@ public class RiverWriter implements Closeable {

// TODO: rename to HibernatingObjectOutputStream?
public RiverWriter(File f, FlowExecutionOwner _owner) throws IOException {
final ExtensionList<PickleFactory> pickleFactories = PickleFactory.all();
if (pickleFactories.isEmpty()) {
throw new IllegalStateException("JENKINS-26137: Jenkins is shutting down");
}
file = f;
owner = _owner;
dout = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
Expand All @@ -107,7 +112,7 @@ public Object writeReplace(Object o) {
return new DryOwner();

if (pickling) {
for (PickleFactory f : PickleFactory.all()) {
for (PickleFactory f : pickleFactories) {
Pickle v = f.writeReplace(o);
if (v != null) {
pickles.add(v);
Expand Down

1 comment on commit 3d3fa34

@jglick
Copy link
Member Author

@jglick jglick commented on 3d3fa34 Jan 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JENKINS-26149 is what I meant to reference, not JENKINS-26051.

Please sign in to comment.