Fix the unit test
@@ -84,13 +84,20 @@ public class ConsoleCommandTest {
@Issue("JENKINS-52181")
@Test public void consoleShouldBeAccessibleForUserWithRead() throws Exception {
- j.createFreeStyleProject("aProject");
+ FreeStyleProject project = j.createFreeStyleProject("aProject");
+ if (Functions.isWindows()) {
+ project.getBuildersList().add(new BatchFile("echo 1"));
+ } else {
+ project.getBuildersList().add(new Shell("echo 1"));
+ }
+ assertThat(project.scheduleBuild2(0).get().getLog(), containsString("echo 1"));
+
final CLICommandInvoker.Result result = command
.authorizedTo(Jenkins.READ, Job.READ)
.invokeWithArgs("aProject");
assertThat(result, succeeded());
- assertThat(result.stdout(), containsString("echo 5"));
+ assertThat(result.stdout(), containsString("echo 1"));
}
@Test public void consoleShouldFailWhenProjectDoesNotExist() throws Exception {
