Skip to content

Commit

Permalink
Test native-image with Process API
Browse files Browse the repository at this point in the history
  • Loading branch information
rbygrave committed Oct 30, 2023
1 parent 80ec89c commit c38fc9b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/native-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ jobs:
run: |
mvn clean install -DskipTests
cd test-native-image
mvn clean package -Pnative
./target/test-native-image
mvn clean package -DskipTests -Pnative
mvn test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
import org.junit.jupiter.api.Test;
import io.ebean.test.containers.*;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.List;

class StartPostgresContainerTest {

@Test
Expand All @@ -13,4 +19,20 @@ void test() {
.build()
.start();
}

@Test
void run() throws Exception {
File out = new File("out");

Process process = new ProcessBuilder()
.command("./target/test-native-image")
.redirectErrorStream(true)
.redirectOutput(ProcessBuilder.Redirect.to(out))
.start();

int code = process.waitFor();
System.out.println("exit " + code);

Files.lines(out.toPath()).forEach(System.out::println);
}
}

0 comments on commit c38fc9b

Please sign in to comment.