Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
import org.junit.rules.ErrorCollector;
import org.junit.rules.TemporaryFolder;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.FlagRule;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.LoggerRule;
Expand All @@ -122,6 +123,7 @@ public class ShellStepTest {
@Rule public TemporaryFolder tmp = new TemporaryFolder();
@Rule public ErrorCollector errors = new ErrorCollector();
@Rule public LoggerRule logging = new LoggerRule();
@Rule public FlagRule<Boolean> useWatching = new FlagRule<>(() -> DurableTaskStep.USE_WATCHING, x -> DurableTaskStep.USE_WATCHING = x);

/**
* Failure in the shell script should mark the step as red
Expand Down Expand Up @@ -392,7 +394,6 @@ private static class Decorator extends LauncherDecorator implements Serializable
@Issue("JENKINS-38381")
@Test public void remoteLogger() throws Exception {
DurableTaskStep.USE_WATCHING = true;
try {
assumeFalse(Functions.isWindows()); // TODO create Windows equivalent
final String credentialsId = "creds";
final String username = "bob";
Expand Down Expand Up @@ -420,9 +421,6 @@ private static class Decorator extends LauncherDecorator implements Serializable
j.assertLogNotContains(password, b);
j.assertLogNotContains(password.toUpperCase(Locale.ENGLISH), b);
j.assertLogContains("CURL -U **** HTTP://SERVER/ [master → remote]", b);
} finally {
DurableTaskStep.USE_WATCHING = false;
}
}
@TestExtension("remoteLogger") public static class LogFile implements LogStorageFactory {
@Override public LogStorage forBuild(FlowExecutionOwner b) {
Expand Down Expand Up @@ -496,7 +494,6 @@ private Object writeReplace() {
@Issue("JENKINS-54133")
@Test public void remoteConsoleNotes() throws Exception {
DurableTaskStep.USE_WATCHING = true;
try {
assumeFalse(Functions.isWindows()); // TODO create Windows equivalent
j.createSlave("remote", null, null);
WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p");
Expand All @@ -523,9 +520,6 @@ private Object writeReplace() {
assertThat("a ConsoleNote created in the " + builtInNodeLabel + " is trusted", w.toString(), containsString("<b>hello</b> from " + builtInNodeLabel));
assertThat("but this one was created in the agent and is discarded", w.toString(), containsString("hello from agent"));
assertThat("however we can pass it from the " + builtInNodeLabel + " to agent", w.toString(), containsString("<b>hello</b> from halfway in between"));
} finally {
DurableTaskStep.USE_WATCHING = false;
}
}
public static final class MarkUpStep extends Step {
@DataBoundSetter public boolean smart;
Expand Down Expand Up @@ -648,8 +642,6 @@ private static final class HelloNote extends ConsoleNote<Run<?, ?>> {
" }\n" +
" }\n" +
"}", true));
boolean origUseWatching = DurableTaskStep.USE_WATCHING;
try {
for (boolean watching : new boolean[] {false, true}) {
DurableTaskStep.USE_WATCHING = watching;
String log = JenkinsRule.getLog(j.assertBuildStatusSuccess(p.scheduleBuild2(0, new ParametersAction(new BooleanParameterValue("WATCHING", watching)))));
Expand All @@ -662,9 +654,6 @@ private static final class HelloNote extends ConsoleNote<Run<?, ?>> {
errors.checkThat(log, not(containsString("watching=false[Pipeline]")));
errors.checkThat(log, not(containsString("watching=true[Pipeline]")));
}
} finally {
DurableTaskStep.USE_WATCHING = origUseWatching;
}
}

@Issue("JENKINS-34021")
Expand Down