Skip to content
Permalink
Browse files

[JENKINS-26137] At least during restarting tests, serialization error…

…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 3d3fa348ed9c34e4492b2733802bc47416824e30
@@ -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;
@@ -48,7 +47,6 @@
});
}

@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 {
@@ -62,6 +60,9 @@
@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));
}
});
@@ -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;
@@ -87,6 +88,10 @@

// 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)));
@@ -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);

1 comment on commit 3d3fa34

@jglick

This comment has been minimized.

Copy link
Member Author

@jglick jglick commented on 3d3fa34 Jan 12, 2015

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

Please sign in to comment.