use of com.google.copybara.util.CommandOutputWithStatus in project copybara by google.
the class CommandRunnerTest method testCommand.
@Test
public void testCommand() throws Exception {
Command command = new Command(new String[] { "echo", "hello", "world" });
CommandOutputWithStatus result = runCommand(new CommandRunner(command));
assertThat(result.getTerminationStatus().success()).isTrue();
assertThat(result.getStdout()).isEqualTo("hello world\n");
assertWithMessage("Not empty: %s", new String(outContent.toByteArray(), UTF_8)).that(outContent.toByteArray()).isEmpty();
assertWithMessage("Not empty: %s", new String(errContent.toByteArray(), UTF_8)).that(errContent.toByteArray()).isEmpty();
assertLogContains("Executing [echo hello world]", "'echo' STDOUT: hello world", "Command 'echo' finished");
}
use of com.google.copybara.util.CommandOutputWithStatus in project copybara by google.
the class CommandRunnerTest method testMaxCommandLength.
@Test
public void testMaxCommandLength() throws Exception {
String[] args = new String[10000];
args[0] = "echo";
for (int i = 1; i < 10000; i++) {
args[i] = "hello world!";
}
Command command = new Command(args);
CommandOutputWithStatus result = runCommand(new CommandRunner(command).withVerbose(true));
assertThat(result.getTerminationStatus().success()).isTrue();
assertLogContains("...", "'echo' STDOUT: hello world!", "Command 'echo' finished");
}
Aggregations