Skip to content

Commit

Permalink
Simplify Scriptler test (#1915)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Feb 6, 2025
1 parent e2adca5 commit 9e43ef0
Showing 1 changed file with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@
*/
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 @@ -41,14 +38,7 @@ public ScriptResult(String result) {
public String output(Node node) {
String name = node.getName();
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);
name = "(" + node.getName() + ")";
}
return output(name);
}
Expand Down

0 comments on commit 9e43ef0

Please # to comment.