@@ -243,6 +243,7 @@ static void staticUnprepare() throws Exception {
243
243
244
244
/**
245
245
* Create the log directory in ./target (build folder), and open a new file using the test method's name.
246
+ *
246
247
* @param testInfo metadata from the test to be logged
247
248
* @return an output file wrapped in a PrintWriter
248
249
* @throws IOException if the PrintWriter fails to open the file
@@ -881,4 +882,59 @@ void createWlsImgWithAdditionalBuildCommands(TestInfo testInfo) throws Exception
881
882
assertTrue (inspect .stdout ().contains ("final-build-commands:finalBuildCommands" ),
882
883
tagName + " does not contain the expected label" );
883
884
}
885
+
886
+ /**
887
+ * Create a WLS image using Java Server JRE image as a base.
888
+ * This tests that the JAVA_HOME is correctly identified and applied in the CREATE.
889
+ *
890
+ * @throws Exception - if any error occurs
891
+ */
892
+ @ Test
893
+ @ Order (26 )
894
+ @ Tag ("nightly" )
895
+ @ DisplayName ("Create image with WLS using Java ServerJRE" )
896
+ void createImageWithServerJRE (TestInfo testInfo ) throws Exception {
897
+ String tagName = build_tag + ":" + getMethodName (testInfo );
898
+ String command = new CreateCommand ()
899
+ .tag (tagName )
900
+ .fromImage ("container-registry.oracle.com/java/serverjre:8" )
901
+ .build ();
902
+
903
+ try (PrintWriter out = getTestMethodWriter (testInfo )) {
904
+ CommandResult result = Runner .run (command , out , logger );
905
+ assertEquals (0 , result .exitValue (), "for command: " + command );
906
+
907
+ // verify the docker image is created
908
+ String imageId = Runner .run ("docker images -q " + tagName , out , logger ).stdout ().trim ();
909
+ assertFalse (imageId .isEmpty (), "Image was not created: " + tagName );
910
+ }
911
+ }
912
+
913
+ /**
914
+ * Update the WLS image created in the previous test.
915
+ * This tests that the JAVA_HOME is correctly identified and applied in the UPDATE.
916
+ *
917
+ * @throws Exception - if any error occurs
918
+ */
919
+ @ Test
920
+ @ Order (27 )
921
+ @ Tag ("nightly" )
922
+ @ DisplayName ("Update image with WLS using Java ServerJRE" )
923
+ void updateImageWithServerJRE (TestInfo testInfo ) throws Exception {
924
+ String tagName = build_tag + ":" + getMethodName (testInfo );
925
+ String command = new UpdateCommand ()
926
+ .fromImage (build_tag + ":createImageWithServerJRE" )
927
+ .tag (tagName )
928
+ .patches (P27342434_ID )
929
+ .build ();
930
+
931
+ try (PrintWriter out = getTestMethodWriter (testInfo )) {
932
+ CommandResult result = Runner .run (command , out , logger );
933
+ assertEquals (0 , result .exitValue (), "for command: " + command );
934
+
935
+ // verify the docker image is created
936
+ String imageId = Runner .run ("docker images -q " + tagName , out , logger ).stdout ().trim ();
937
+ assertFalse (imageId .isEmpty (), "Image was not created: " + tagName );
938
+ }
939
+ }
884
940
}
0 commit comments