use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.
the class SvnCommandTest method shouldRecogniseSvnAsTheSameIfURLContainsSpaces.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldRecogniseSvnAsTheSameIfURLContainsSpaces() throws Exception {
File working = TempDirUtils.createTempDirectoryIn(tempDir, "shouldRecogniseSvnAsTheSameIfURLContainsSpaces").toFile();
SvnTestRepo repo = new SvnTestRepo(tempDir, "a directory with spaces");
SvnMaterial material = repo.material();
assertThat(material.getUrl()).contains("%20");
InMemoryStreamConsumer output = new InMemoryStreamConsumer();
material.freshCheckout(output, new SubversionRevision("3"), working);
assertThat(output.getAllOutput()).contains("Checked out revision 3");
InMemoryStreamConsumer output2 = new InMemoryStreamConsumer();
material.updateTo(output2, working, new RevisionContext(new SubversionRevision("4")), new TestSubprocessExecutionContext());
assertThat(output2.getAllOutput()).contains("Updated to revision 4");
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.
the class SvnCommandTest method shouldRecogniseSvnAsTheSameIfURLUsesFileProtocol.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldRecogniseSvnAsTheSameIfURLUsesFileProtocol() throws Exception {
SvnTestRepo repo = new SvnTestRepo(tempDir);
File working = TempDirUtils.createTempDirectoryIn(tempDir, "someDir").toFile();
SvnMaterial material = repo.material();
InMemoryStreamConsumer output = new InMemoryStreamConsumer();
material.freshCheckout(output, new SubversionRevision("3"), working);
assertThat(output.getAllOutput()).contains("Checked out revision 3");
InMemoryStreamConsumer output2 = new InMemoryStreamConsumer();
updateMaterial(material, new SubversionRevision("4"), working, output2);
assertThat(output2.getAllOutput()).contains("Updated to revision 4");
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.
the class CommandLineTest method shouldBeAbleToSpecifyEncoding.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldBeAbleToSpecifyEncoding() {
String chrisWasHere = "?????";
CommandLine line = CommandLine.createCommandLine("echo").withArg(chrisWasHere).withEncoding("UTF-8");
InMemoryStreamConsumer output = new InMemoryStreamConsumer();
ProcessWrapper processWrapper = line.execute(output, new EnvironmentVariableContext(), null);
processWrapper.waitForExit();
assertThat(output.getAllOutput(), containsString(chrisWasHere));
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.
the class CommandLineTest method shouldBeAbleToRunCommandsInSubdirectoriesWithNoWorkingDir.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldBeAbleToRunCommandsInSubdirectoriesWithNoWorkingDir() throws IOException {
File shellScript = createScriptInSubFolder("hello-world.sh", "echo 'Hello World!'");
assertThat(shellScript.setExecutable(true), is(true));
CommandLine line = CommandLine.createCommandLine("subFolder/hello-world.sh").withWorkingDir(temporaryFolder.toFile()).withEncoding("utf-8");
InMemoryStreamConsumer out = new InMemoryStreamConsumer();
line.execute(out, new EnvironmentVariableContext(), null).waitForExit();
assertThat(out.getAllOutput(), containsString("Hello World!"));
}
use of org.junit.jupiter.api.condition.DisabledOnOs in project gocd by gocd.
the class CommandLineTest method shouldNotLogPasswordsOnExceptionThrown.
@Test
@DisabledOnOs(OS.WINDOWS)
void shouldNotLogPasswordsOnExceptionThrown() throws IOException {
File file = Files.writeString(temporaryFolder.resolve("test.sh"), "echo $1 && exit 10", UTF_8).toFile();
CommandLine line = CommandLine.createCommandLine("/bin/sh").withArg(file.getAbsolutePath()).withArg(new PasswordArgument("secret")).withEncoding("utf-8");
assertThatThrownBy(() -> line.runOrBomb(null)).isExactlyInstanceOf(CommandLineException.class).hasMessageContaining("EXIT CODE (10)").hasMessageNotContaining("secret");
}
Aggregations