Skip to content

Commit

Permalink
JENKINS-74974 - Adapt Scriptler test to use preferred terminology (#1859
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
mtughan authored Dec 10, 2024
1 parent ad3e0ee commit 470620c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@
*/
package org.jenkinsci.test.acceptance.plugins.scriptler;

import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jenkinsci.test.acceptance.po.Jenkins;
import org.jenkinsci.test.acceptance.po.Node;

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

public ScriptResult(String result) {
Expand All @@ -37,8 +40,15 @@ public ScriptResult(String result) {

public String output(Node node) {
String name = node.getName();
if (node instanceof Jenkins && "(master)".equals(name)) {
name = "(controller)";
if (node instanceof Jenkins) {
// TODO: use the below code once Scriptler versions 390 and up are the only ones tested
// return "(" + node + ")";
return BUILT_IN_NODE_NAMES.stream()
.map(nodeName -> "(" + nodeName + ")")
.map(this::output)
.filter(Objects::nonNull)
.findFirst()
.orElse(null);
}
return output(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public <T extends PageObject> T getPluginPage(Class<T> type) {

@Override
public String getName() {
return "(master)";
return "built-in";
}

@Override
Expand Down

0 comments on commit 470620c

Please sign in to comment.