1- // Copyright (c) 2023, Oracle and/or its affiliates.
1+ // Copyright (c) 2023, 2025, Oracle and/or its affiliates.
22// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
44package oracle .weblogic .kubernetes ;
3131import static oracle .weblogic .kubernetes .TestConstants .BUSYBOX_TAG ;
3232import static oracle .weblogic .kubernetes .TestConstants .DB_IMAGE_NAME ;
3333import static oracle .weblogic .kubernetes .TestConstants .DB_IMAGE_TAG ;
34+ import static oracle .weblogic .kubernetes .TestConstants .DB_PDB_ID_DEFAULT_19C ;
3435import static oracle .weblogic .kubernetes .TestConstants .FMWINFRA_IMAGE_TAG ;
3536import static oracle .weblogic .kubernetes .TestConstants .FMWINFRA_IMAGE_TO_USE_IN_SPEC ;
3637import static oracle .weblogic .kubernetes .TestConstants .IMAGE_NAME_OPERATOR ;
6364import static oracle .weblogic .kubernetes .utils .SampleUtils .createPVHostPathAndChangePermissionInKindCluster ;
6465import static oracle .weblogic .kubernetes .utils .ThreadSafeLogger .getLogger ;
6566import static org .junit .jupiter .api .Assertions .assertNotNull ;
67+ import static org .junit .jupiter .api .Assertions .assertTrue ;
6668
6769/**
6870 * Test and verify Domain on PV FMW domain sample.
@@ -141,6 +143,7 @@ public static void initAll(@Namespaces(4) List<String> namespaces) {
141143 envMap .put ("OPER_IMAGE_NAME" , TEST_IMAGES_PREFIX + IMAGE_NAME_OPERATOR );
142144 envMap .put ("DOMAIN_CREATION_IMAGE_NAME" , TEST_IMAGES_PREFIX + DOMAIN_CREATION_IMAGE_NAME );
143145 envMap .put ("DB_IMAGE_PULL_SECRET" , BASE_IMAGES_REPO_SECRET_NAME );
146+ envMap .put ("DB_PDB_ID" , DB_PDB_ID_DEFAULT_19C );
144147
145148 // kind cluster uses openjdk which is not supported by image tool
146149 if (WIT_JAVA_HOME != null ) {
@@ -181,7 +184,7 @@ public static void initAll(@Namespaces(4) List<String> namespaces) {
181184 @ Order (1 )
182185 public void testInstallOperator () {
183186 String backupReports = backupReports (UniqueName .uniqueName (this .getClass ().getSimpleName ()));
184- execTestScriptAndAssertSuccess ("-oper" , "Failed to run -oper" );
187+ assertTrue ( execTestScriptAndAssertSuccess ("-oper" , "Failed to run -oper" ) );
185188 restoreReports (backupReports );
186189 }
187190
@@ -191,7 +194,8 @@ public void testInstallOperator() {
191194 @ Test
192195 @ Order (2 )
193196 public void testInstallTraefik () {
194- execTestScriptAndAssertSuccess ("-traefik" , "Failed to run -traefik" );
197+ Assumptions .assumeTrue (previousTestSuccessful );
198+ assertTrue (execTestScriptAndAssertSuccess ("-traefik" , "Failed to run -traefik" ));
195199 }
196200
197201 /**
@@ -200,7 +204,8 @@ public void testInstallTraefik() {
200204 @ Test
201205 @ Order (3 )
202206 public void testPrecleandb () {
203- execTestScriptAndAssertSuccess ("-precleandb" , "Failed to run -precleandb" );
207+ Assumptions .assumeTrue (previousTestSuccessful );
208+ assertTrue (execTestScriptAndAssertSuccess ("-precleandb" , "Failed to run -precleandb" ));
204209 }
205210
206211 /**
@@ -209,25 +214,38 @@ public void testPrecleandb() {
209214 @ Test
210215 @ Order (4 )
211216 public void testCreatedb () {
217+ Assumptions .assumeTrue (previousTestSuccessful );
212218 logger .info ("test case for creating a db" );
213219 if (KIND_REPO != null ) {
214220 String dbimage = DB_IMAGE_NAME + ":" + DB_IMAGE_TAG ;
215221 logger .info ("loading image {0} to kind" , dbimage );
216222 imagePush (dbimage );
217223 }
218- execTestScriptAndAssertSuccess ("-db" , "Failed to run -db" );
224+ assertTrue ( execTestScriptAndAssertSuccess ("-db" , "Failed to run -db" ) );
219225 }
220226
221227 /**
222- * Test Domain on PV sample building image for FMW domain use case .
228+ * Test Domain on PV sample - Initialize schemas in the DB .
223229 */
224230 @ Test
225231 @ Order (5 )
232+ public void testCreateRCU () {
233+ Assumptions .assumeTrue (previousTestSuccessful );
234+ logger .info ("test case for initializing schemas in the DB" );
235+ assertTrue (execTestScriptAndAssertSuccess ("-rcu" , "Failed to run -rcu" ));
236+ }
237+
238+ /**
239+ * Test Domain on PV sample building image for FMW domain use case.
240+ */
241+ @ Test
242+ @ Order (6 )
226243 public void testInitialImage () {
244+ Assumptions .assumeTrue (previousTestSuccessful );
227245 logger .info ("test case for building image" );
228246 imagePull (BUSYBOX_IMAGE + ":" + BUSYBOX_TAG );
229247 imageTag (BUSYBOX_IMAGE + ":" + BUSYBOX_TAG , "busybox" );
230- execTestScriptAndAssertSuccess ("-initial-image" , "Failed to run -initial-image" );
248+ assertTrue ( execTestScriptAndAssertSuccess ("-initial-image" , "Failed to run -initial-image" ) );
231249 ExecResult result = Command .withParams (
232250 new CommandParams ()
233251 .command (WLSIMG_BUILDER + " images" )
@@ -247,8 +265,9 @@ public void testInitialImage() {
247265 * Test Domain on PV sample create FMW domain use case.
248266 */
249267 @ Test
250- @ Order (6 )
268+ @ Order (7 )
251269 public void testInitialMain () {
270+ Assumptions .assumeTrue (previousTestSuccessful );
252271 logger .info ("test case for creating a FMW domain" );
253272
254273 // load the base image to kind if using kind cluster
@@ -262,7 +281,7 @@ public void testInitialMain() {
262281 withLongRetryPolicy ,
263282 checkTestScriptAndAssertSuccess ("-initial-main" , "Failed to run -initial-main" ),
264283 logger ,
265- "create PV HostPath and change Permission in Kind Cluster " );
284+ "creating FMW domain " );
266285 }
267286
268287 /**
@@ -273,7 +292,6 @@ public void testInitialMain() {
273292 private boolean execTestScriptAndAssertSuccess (String arg ,
274293 String errString ) {
275294
276- Assumptions .assumeTrue (previousTestSuccessful );
277295 previousTestSuccessful = false ;
278296
279297 String command = domainOnPvSampleScript
@@ -293,14 +311,14 @@ private boolean execTestScriptAndAssertSuccess(String arg,
293311 && result .stdout () != null
294312 && result .stdout ().contains ("Finished without errors" );
295313
296- String outStr = errString ;
297- outStr += ", command=\n {\n " + command + "\n }\n " ;
314+ String outStr = success ? "Running test script succeeds: " : errString + ":" ;
315+ outStr += " command=\n {\n " + command + "\n }\n " ;
298316 outStr += ", stderr=\n {\n " + (result != null ? result .stderr () : "" ) + "\n }\n " ;
299317 outStr += ", stdout=\n {\n " + (result != null ? result .stdout () : "" ) + "\n }\n " ;
300318
301319 logger .info ("output String is: {0}" , outStr );
302320
303- previousTestSuccessful = true ;
321+ previousTestSuccessful = success ;
304322
305323 return success ;
306324 }
0 commit comments