Skip to content

Commit 470620c

Browse files
authored
JENKINS-74974 - Adapt Scriptler test to use preferred terminology (#1859)
Scriptler 390 and above use "(built-in)" to refer to the built-in node instead of "(controller)" or "(master)". Update the test harness to check for any of these terms. The adaptation code can be simplified once older versions of the Scriptler plugin are no longer being tested.
1 parent ad3e0ee commit 470620c

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/main/java/org/jenkinsci/test/acceptance/plugins/scriptler/ScriptResult.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@
2323
*/
2424
package org.jenkinsci.test.acceptance.plugins.scriptler;
2525

26+
import java.util.List;
27+
import java.util.Objects;
2628
import java.util.regex.Matcher;
2729
import java.util.regex.Pattern;
2830
import org.jenkinsci.test.acceptance.po.Jenkins;
2931
import org.jenkinsci.test.acceptance.po.Node;
3032

3133
public class ScriptResult {
34+
private static final List<String> BUILT_IN_NODE_NAMES = List.of("built-in", "controller", "master");
3235
private final String result;
3336

3437
public ScriptResult(String result) {
@@ -37,8 +40,15 @@ public ScriptResult(String result) {
3740

3841
public String output(Node node) {
3942
String name = node.getName();
40-
if (node instanceof Jenkins && "(master)".equals(name)) {
41-
name = "(controller)";
43+
if (node instanceof Jenkins) {
44+
// TODO: use the below code once Scriptler versions 390 and up are the only ones tested
45+
// return "(" + node + ")";
46+
return BUILT_IN_NODE_NAMES.stream()
47+
.map(nodeName -> "(" + nodeName + ")")
48+
.map(this::output)
49+
.filter(Objects::nonNull)
50+
.findFirst()
51+
.orElse(null);
4252
}
4353
return output(name);
4454
}

src/main/java/org/jenkinsci/test/acceptance/po/Jenkins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public <T extends PageObject> T getPluginPage(Class<T> type) {
216216

217217
@Override
218218
public String getName() {
219-
return "(master)";
219+
return "built-in";
220220
}
221221

222222
@Override

0 commit comments

Comments
 (0)