< prev index next >

test/testlibrary/com/oracle/java/testlibrary/DockerTestUtils.java

Print this page
rev 9061 : 8222888: [TESTBUG] docker/TestJFREvents.java fails due to "RuntimeException: JAVA_MAIN_CLASS_ is not defined"
Summary: Introduced unique environment variable
Reviewed-by: egahlin, lmesnik, sgehwolf

*** 165,183 **** .shouldContain("Successfully built"); } /** ! * Run Java inside the docker image with specified parameters and options. * * @param DockerRunOptions optins for running docker * ! * @return output of the run command * @throws Exception */ ! public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Exception { ! ArrayList<String> cmd = new ArrayList<>(); cmd.add("docker"); cmd.add("run"); if (opts.tty) cmd.add("--tty=true"); --- 165,183 ---- .shouldContain("Successfully built"); } /** ! * Build the docker command to run java inside a container * * @param DockerRunOptions optins for running docker * ! * @return command * @throws Exception */ ! public static List<String> buildJavaCommand(DockerRunOptions opts) throws Exception { ! List<String> cmd = new ArrayList<>(); cmd.add("docker"); cmd.add("run"); if (opts.tty) cmd.add("--tty=true");
*** 193,205 **** Collections.addAll(cmd, Utils.getTestJavaOpts()); } cmd.add(opts.classToRun); cmd.addAll(opts.classParams); ! return execute(cmd); } /** * Remove docker image * * @param DockerRunOptions optins for running docker --- 193,216 ---- Collections.addAll(cmd, Utils.getTestJavaOpts()); } cmd.add(opts.classToRun); cmd.addAll(opts.classParams); ! return cmd; } + /** + * Run Java inside the docker image with specified parameters and options. + * + * @param DockerRunOptions optins for running docker + * + * @return output of the run command + * @throws Exception + */ + public static OutputAnalyzer dockerRunJava(DockerRunOptions opts) throws Exception { + return execute(buildJavaCommand(opts)); + } /** * Remove docker image * * @param DockerRunOptions optins for running docker
< prev index next >