Skip to content

Commit eb62f10

Browse files
authored
Merge pull request jenkinsci#95 from dwnusbaum/pct-cleanup
Update dependencies and remove test using LocalData to fix PCT failures
2 parents 7035719 + ba730c2 commit eb62f10

File tree

17 files changed

+7
-254
lines changed

17 files changed

+7
-254
lines changed

pom.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
<changelist>-SNAPSHOT</changelist>
6767
<jenkins.version>2.150.1</jenkins.version>
6868
<java.level>8</java.level>
69-
<workflow-step-api-plugin.version>2.16</workflow-step-api-plugin.version>
70-
<workflow-support-plugin.version>2.21</workflow-support-plugin.version>
69+
<workflow-step-api-plugin.version>2.18</workflow-step-api-plugin.version>
70+
<workflow-support-plugin.version>3.1</workflow-support-plugin.version>
7171
</properties>
7272
<dependencies>
7373
<dependency>
@@ -83,7 +83,7 @@
8383
<dependency>
8484
<groupId>org.jenkins-ci.plugins.workflow</groupId>
8585
<artifactId>workflow-api</artifactId>
86-
<version>2.31</version>
86+
<version>2.33</version>
8787
</dependency>
8888
<dependency>
8989
<groupId>org.jenkins-ci.plugins.workflow</groupId>
@@ -93,19 +93,19 @@
9393
<dependency>
9494
<groupId>org.jenkins-ci.plugins.workflow</groupId>
9595
<artifactId>workflow-cps</artifactId>
96-
<version>2.61</version>
96+
<version>2.62</version>
9797
<scope>test</scope>
9898
</dependency>
9999
<dependency>
100100
<groupId>org.jenkins-ci.plugins.workflow</groupId>
101101
<artifactId>workflow-job</artifactId>
102-
<version>2.26</version>
102+
<version>2.31</version>
103103
<scope>test</scope>
104104
</dependency>
105105
<dependency>
106106
<groupId>org.jenkins-ci.plugins.workflow</groupId>
107107
<artifactId>workflow-basic-steps</artifactId>
108-
<version>2.2</version>
108+
<version>2.14</version>
109109
<scope>test</scope>
110110
</dependency>
111111
<dependency>
@@ -143,7 +143,7 @@
143143
<dependency>
144144
<groupId>org.jenkins-ci.plugins</groupId>
145145
<artifactId>script-security</artifactId>
146-
<version>1.48</version>
146+
<version>1.50</version>
147147
</dependency>
148148
<dependency>
149149
<groupId>org.jenkins-ci.plugins</groupId>

src/test/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest.java

-112
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import com.google.common.base.Predicate;
2929
import hudson.FilePath;
3030
import hudson.Functions;
31-
import hudson.init.InitMilestone;
32-
import hudson.init.Initializer;
3331
import hudson.model.Computer;
3432
import hudson.model.Executor;
3533
import hudson.model.Item;
@@ -57,13 +55,6 @@
5755
import java.io.FileOutputStream;
5856
import java.io.IOException;
5957
import java.io.StringWriter;
60-
import java.lang.reflect.Field;
61-
import java.nio.charset.StandardCharsets;
62-
import java.nio.file.FileVisitResult;
63-
import java.nio.file.Files;
64-
import java.nio.file.Path;
65-
import java.nio.file.SimpleFileVisitor;
66-
import java.nio.file.attribute.BasicFileAttributes;
6758
import java.util.ArrayList;
6859
import java.util.Arrays;
6960
import java.util.Collections;
@@ -86,11 +77,9 @@
8677
import net.sf.json.JSONObject;
8778
import net.sf.json.groovy.JsonSlurper;
8879
import org.acegisecurity.Authentication;
89-
import org.apache.commons.io.FileUtils;
9080
import org.apache.commons.io.IOUtils;
9181
import org.apache.tools.ant.util.JavaEnvUtils;
9282
import static org.hamcrest.Matchers.*;
93-
import org.jboss.marshalling.ObjectResolver;
9483
import org.jenkinsci.plugins.durabletask.FileMonitoringTask;
9584
import org.jenkinsci.plugins.workflow.actions.LogAction;
9685
import org.jenkinsci.plugins.workflow.actions.QueueItemAction;
@@ -108,7 +97,6 @@
10897
import org.jenkinsci.plugins.workflow.steps.EchoStep;
10998
import org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep;
11099
import org.jenkinsci.plugins.workflow.steps.durable_task.Messages;
111-
import org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverReader;
112100
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
113101
import org.junit.AfterClass;
114102
import static org.junit.Assert.*;
@@ -126,7 +114,6 @@
126114
import org.jvnet.hudson.test.MockAuthorizationStrategy;
127115
import org.jvnet.hudson.test.RestartableJenkinsRule;
128116
import org.jvnet.hudson.test.TestExtension;
129-
import org.jvnet.hudson.test.recipes.LocalData;
130117

131118
/** Tests pertaining to {@code node} and {@code sh} steps. */
132119
public class ExecutorStepTest {
@@ -1121,105 +1108,6 @@ List<String> currentLabels() {
11211108
});
11221109
}
11231110

1124-
@Issue("JENKINS-39134")
1125-
@LocalData
1126-
@Test public void serialForm() {
1127-
story.addStep(new Statement() {
1128-
@Override public void evaluate() throws Throwable {
1129-
WorkflowJob p = story.j.jenkins.getItemByFullName("p", WorkflowJob.class);
1130-
WorkflowRun b = p.getBuildByNumber(1);
1131-
assertThat(patchedFiles, containsInAnyOrder(/* "program.dat", */"3.xml", "3.log", "log"));
1132-
/* TODO this seems to randomly not include the expected items:
1133-
assertThat(patchedFields, Matchers.containsInAnyOrder(
1134-
// But not FileMonitoringController.controlDir, since this old version is still using location-independent .id.
1135-
"private final java.lang.String org.jenkinsci.plugins.workflow.support.pickles.FilePathPickle.path",
1136-
"private final java.lang.String org.jenkinsci.plugins.workflow.support.pickles.WorkspaceListLeasePickle.path",
1137-
"private java.lang.String org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.remote"));
1138-
*/
1139-
story.j.assertLogContains("simulated later output", story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b)));
1140-
}
1141-
});
1142-
}
1143-
private static final List<String> patchedFiles = new ArrayList<>();
1144-
private static final List<String> patchedFields = new ArrayList<>();
1145-
// TODO @TestExtension("serialForm") ItemListener does not work since we need to run before FlowExecutionList.ItemListenerImpl yet TestExtension does not support ordinal
1146-
@Initializer(before = InitMilestone.JOB_LOADED) public static void replaceWorkspacePath() throws Exception {
1147-
final File prj = new File(Jenkins.getInstance().getRootDir(), "jobs/p");
1148-
final File workspace = new File(prj, "workspace");
1149-
final String ORIG_WS = "/space/tmp/AbstractStepExecutionImpl-upgrade/jobs/p/workspace";
1150-
final String newWs = workspace.getAbsolutePath();
1151-
File controlDir = new File(workspace, ".eb6272d3");
1152-
if (!controlDir.isDirectory()) {
1153-
return;
1154-
}
1155-
System.err.println("Patching " + controlDir);
1156-
RiverReader.customResolver = new ObjectResolver() {
1157-
@Override public Object readResolve(Object replacement) {
1158-
Class<?> c = replacement.getClass();
1159-
//System.err.println("replacing " + c.getName());
1160-
while (c != Object.class) {
1161-
for (Field f : c.getDeclaredFields()) {
1162-
if (f.getType() == String.class) {
1163-
try {
1164-
f.setAccessible(true);
1165-
Object v = f.get(replacement);
1166-
if (ORIG_WS.equals(v)) {
1167-
//System.err.println("patching " + f);
1168-
f.set(replacement, newWs);
1169-
patchedFields.add(f.toString());
1170-
} else if (newWs.equals(v)) {
1171-
//System.err.println(f + " was already patched, somehow?");
1172-
} else {
1173-
//System.err.println("some other value " + v + " for " + f);
1174-
}
1175-
} catch (Exception x) {
1176-
x.printStackTrace();
1177-
}
1178-
}
1179-
}
1180-
c = c.getSuperclass();
1181-
}
1182-
return replacement;
1183-
}
1184-
@Override public Object writeReplace(Object original) {
1185-
throw new IllegalStateException();
1186-
}
1187-
};
1188-
Files.walkFileTree(prj.toPath(), new SimpleFileVisitor<Path>() {
1189-
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
1190-
File f = file.toFile();
1191-
String name = f.getName();
1192-
if (name.equals("program.dat")) {
1193-
/* TODO could not get this to work; stream appeared corrupted:
1194-
patchedFiles.add(name);
1195-
String origContent = FileUtils.readFileToString(f, StandardCharsets.ISO_8859_1);
1196-
String toReplace = String.valueOf((char) Protocol.ID_STRING_SMALL) + String.valueOf((char) ORIG_WS.length()) + ORIG_WS;
1197-
int newLen = newWs.length();
1198-
String replacement = String.valueOf((char) Protocol.ID_STRING_MEDIUM) +
1199-
String.valueOf((char) (newLen & 0xff00) >> 8) +
1200-
String.valueOf((char) newLen & 0xff) +
1201-
newWs; // TODO breaks if not ASCII
1202-
String replacedContent = origContent.replace(toReplace, replacement);
1203-
assertNotEquals("failed to replace ‘" + toReplace + "’", replacedContent, origContent);
1204-
FileUtils.writeStringToFile(f, replacedContent, StandardCharsets.ISO_8859_1);
1205-
*/
1206-
} else {
1207-
String origContent = FileUtils.readFileToString(f, StandardCharsets.ISO_8859_1);
1208-
String replacedContent = origContent.replace(ORIG_WS, newWs);
1209-
if (!replacedContent.equals(origContent)) {
1210-
patchedFiles.add(name);
1211-
FileUtils.writeStringToFile(f, replacedContent, StandardCharsets.ISO_8859_1);
1212-
}
1213-
}
1214-
return super.visitFile(file, attrs);
1215-
}
1216-
});
1217-
FilePath controlDirFP = new FilePath(controlDir);
1218-
controlDirFP.child("jenkins-result.txt").write("0", null);
1219-
FilePath log = controlDirFP.child("jenkins-log.txt");
1220-
log.write(log.readToString() + "simulated later output\n", null);
1221-
}
1222-
12231111
@Issue("SECURITY-675")
12241112
@Test public void authentication() {
12251113
story.then(r -> {

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/3.log

-1
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/5.log

-2
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/build.xml

-35
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/log

-7
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/workflow/2.xml

-7
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/workflow/3.xml

-23
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/workflow/4.xml

-16
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/builds/2017-01-09_09-19-54/workflow/5.xml

-18
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/config.xml

-14
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/nextBuildNumber

-1
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/workspace/.eb6272d3/jenkins-log.txt

-1
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/workspace/.eb6272d3/pid

-1
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/jobs/p/workspace/.eb6272d3/script.sh

-2
This file was deleted.

src/test/resources/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest/serialForm/org.jenkinsci.plugins.workflow.flow.FlowExecutionList.xml

-7
This file was deleted.

0 commit comments

Comments
 (0)