Skip to content

Commit f0a1a3f

Browse files
committed
Merge branch 'master-upstream' into 906-init-compatibility
# Conflicts: # cli/tests/functional/src/test/java/io/helidon/build/cli/tests/CliDistributionTest.java
2 parents 9c88a4f + 08701af commit f0a1a3f

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

cli/tests/functional/src/test/java/io/helidon/build/cli/tests/CliDistributionTest.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
import java.nio.file.Path;
2121
import java.util.List;
2222
import java.util.NoSuchElementException;
23+
import java.util.concurrent.ExecutionException;
24+
import java.util.concurrent.TimeUnit;
25+
import java.util.concurrent.TimeoutException;
2326
import java.util.logging.Logger;
2427
import java.util.stream.Collectors;
2528

@@ -120,18 +123,23 @@ private void runVersionTest(String cliExecutable) throws IOException {
120123
}
121124

122125
private void runCreateProjectTest(String cliExecutable) throws IOException {
123-
Path dir = Files.createTempDirectory("project");
124-
Process process = new ProcessBuilder()
125-
.directory(dir.toFile())
126-
.command(cliExecutable, "init", "--reset", "--batch")
127-
.start();
128-
String result = String.join("\n", InputStreams.toLines(process.getInputStream()));
129-
LOGGER.info("errors : " + String.join("\n", InputStreams.toLines(process.getErrorStream())));
130-
LOGGER.info("result output : " + result);
131-
process.destroy();
132-
133-
LOGGER.info("exitValue - " + process.exitValue());
134-
assertThat(result, containsString("Switch directory to"));
135-
assertThat(list(dir).size(), is(not(0)));
126+
try {
127+
Path dir = Files.createTempDirectory("project");
128+
Process process = new ProcessBuilder()
129+
.directory(dir.toFile())
130+
.command(cliExecutable, "init", "--reset", "--batch")
131+
.start()
132+
.onExit()
133+
.get(5, TimeUnit.MINUTES);
134+
String result = String.join("", InputStreams.toLines(process.getInputStream()));
135+
LOGGER.info("errors - " + InputStreams.toLines(process.getErrorStream()));
136+
process.destroy();
137+
LOGGER.info("exitValue - " + process.exitValue());
138+
LOGGER.info(result);
139+
assertThat(result, containsString("Switch directory to"));
140+
assertThat(list(dir).size(), is(not(0)));
141+
} catch (InterruptedException | ExecutionException | TimeoutException e) {
142+
throw new RuntimeException(e);
143+
}
136144
}
137145
}

0 commit comments

Comments
 (0)