File tree Expand file tree Collapse file tree 9 files changed +34
-15
lines changed
Expand file tree Collapse file tree 9 files changed +34
-15
lines changed Original file line number Diff line number Diff line change 11bazel- *
2+ .ijwb
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ junit_docker_compose_test(
9494 test_srcs = glob(["**/*Test.java"]),
9595 test_deps = ["@maven//:org_junit_jupiter_junit_jupiter_api"],
9696 classpath_jars = ["@maven//:org_junit_platform_junit_platform_console_standalone"],
97- test_image_base = "@distroless_java ",
97+ test_image_base = "@openjdk ",
9898)
9999```
100100
Original file line number Diff line number Diff line change 1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515
16+ echo " [DEBUG] JAVA_HOME before discovery logic: $JAVA_HOME "
17+
1618# if JAVA_HOME is not set, just default to /usr (works if /usr/bin/java exists)
1719if [[ -z " $JAVA_HOME " ]]; then
18- JAVA_HOME=" /usr"
20+ export JAVA_HOME=" /usr"
1921# this is used if JAVA_HOME contains an * (if version changes regularly this can be useful)
20- elif [[ " $JAVA_HOME " == * " \* " * ]] ; then
21- JAVA_HOME=$( find $JAVA_HOME -maxdepth 1 | head -n 1)
22+ elif echo " $JAVA_HOME " | grep ' * ' > /dev/null ; then
23+ export JAVA_HOME=$( find $JAVA_HOME -maxdepth 1 | head -n 1)
2224fi
2325
26+ echo " [DEBUG] JAVA_HOME after discovery logic: $JAVA_HOME "
27+ export PATH=$JAVA_HOME /bin:$PATH
28+ echo " [DEBUG] PATH: $PATH "
29+
2430TEST_UBER_JAR=$( find ./ -maxdepth 1 -name ' *_uber_jar_deploy.jar' )
2531JUNIT_PLATFORM_CONSOLE_STANDALONE_JAR=$( find ./ -maxdepth 1 -name ' *junit-platform-console-standalone*.jar' )
2632
Original file line number Diff line number Diff line change 1+ common --test_output=errors
2+ common --verbose_explanations
Original file line number Diff line number Diff line change @@ -50,10 +50,13 @@ oci_register_toolchains(
5050load ("@rules_oci//oci:pull.bzl" , "oci_pull" )
5151
5252oci_pull (
53- name = "distroless_java" ,
54- # tag = "debug", # debug distroless image can be debugged with --entrypoint "/busybox/sh"
55- digest = "sha256:73c3687a9d7277f480a560ae380ba16acbe8eb5a0f459560b4466bb71e6288a1" ,
56- image = "gcr.io/distroless/java17" ,
53+ name = "openjdk" ,
54+ digest = "sha256:29c44ad7bb159a29a4458b74e8d37c1995cb8dc32abdd35e6d3e3d493e682d10" ,
55+ image = "openjdk" ,
56+ platforms = [
57+ "linux/amd64" ,
58+ "linux/arm64/v8" ,
59+ ],
5760)
5861
5962oci_pull (
Original file line number Diff line number Diff line change @@ -22,5 +22,5 @@ junit_docker_compose_test(
2222 test_srcs = glob (["**/*Test.java" ]),
2323 test_deps = ["@maven//:org_junit_jupiter_junit_jupiter_api" ],
2424 classpath_jars = ["@maven//:org_junit_platform_junit_platform_console_standalone" ],
25- test_image_base = "@distroless_java " ,
25+ test_image_base = "@openjdk " ,
2626)
Original file line number Diff line number Diff line change 1818package com .salesforce .rules_docker_compose_test .HelloTest ;
1919
2020import org .junit .jupiter .api .Test ;
21- import static org . junit . jupiter . api . Assertions . assertTrue ;
21+ import java . io . IOException ;
2222
23+ import static org .junit .jupiter .api .Assertions .assertEquals ;
24+ import static org .junit .jupiter .api .Assertions .assertTrue ;
2325
2426class HelloTest {
2527
2628 @ Test
27- void helloWorldContainsHello () {
29+ void helloWorldContainsHello () throws IOException , InterruptedException {
30+ // Testing that the $JAVA_HOME/bin binaries are available
31+ ProcessBuilder processBuilder = new ProcessBuilder (new String []{"sh" , "-c" , "jstat --help" });
32+ Process process = processBuilder .start ();
33+ int exitValue = process .waitFor ();
34+ assertEquals (0 , exitValue );
2835 assertTrue ("Hello World!" .contains ("Hello" ));
2936 }
30- }
37+ }
Original file line number Diff line number Diff line change 1616services :
1717 test_container :
1818 image : junit-image-test:test_container
19- entrypoint : ["/busybox/sh ", "./test_container_entrypoint.sh"]
19+ entrypoint : ["/bin/bash ", "./test_container_entrypoint.sh"]
2020 environment :
21- - JAVA_HOME=/usr/
21+ - JAVA_HOME=/usr/local/openjdk-*
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ pkg_tar(
2525
2626oci_image (
2727 name = "java_image" ,
28- base = "@distroless_java " ,
28+ base = "@openjdk " ,
2929 tars = [
3030 ":files" ,
3131 ],
You can’t perform that action at this time.
0 commit comments