@@ -144,7 +144,6 @@ public static void initAll(@Namespaces(5) List<String> namespaces) {
144144
145145 // install operator and verify its running in ready state
146146 installAndVerifyOperator (opNamespace , domainNamespace );
147-
148147 }
149148
150149 /**
@@ -208,7 +207,7 @@ void testSampleDomainInImage(String model) {
208207
209208 /**
210209 * Test domain in pv samples using domains created by wlst and wdt.
211- * In domain on pv using wdt usecase , we also run the update domain script from the samples,
210+ * In domain on pv using wdt and wlst usecases , we also run the update domain script from the samples,
212211 * to add a cluster to the domain.
213212 *
214213 * @param model domain name and script type to create domain. Acceptable values of format String:wlst|wdt
@@ -255,13 +254,11 @@ void testSampleDomainInPv(String model) {
255254 // run create-domain.sh to create domain.yaml file, run kubectl to create the domain and verify
256255 createDomainAndVerify (domainName , sampleBase );
257256
258- if (script .equals ("wdt" )) {
259- copyModelFileForUpdateDomain (sampleBase );
260- updateDomainAndVerify (domainName , sampleBase , domainNamespace );
261- }
257+ // update the domain to add a new cluster
258+ copyModelFileForUpdateDomain (sampleBase );
259+ updateDomainAndVerify (domainName , sampleBase , domainNamespace , script );
262260 }
263261
264-
265262 /**
266263 * Test scripts for stopping and starting a managed server.
267264 */
@@ -621,7 +618,10 @@ private void createDomainAndVerify(String domainName, Path sampleBase, String...
621618 }
622619 }
623620
624- private void updateDomainAndVerify (String domainName , Path sampleBase , String domainNamespace ) {
621+ private void updateDomainAndVerify (String domainName ,
622+ Path sampleBase ,
623+ String domainNamespace ,
624+ String script ) {
625625 //First copy the update model file to wdt dir and rename it wdt-model_dynamic.yaml
626626 assertDoesNotThrow (() -> {
627627 copyFile (Paths .get (sampleBase .toString (), UPDATE_MODEL_FILE ).toFile (),
@@ -640,6 +640,22 @@ private void updateDomainAndVerify(String domainName, Path sampleBase, String do
640640 boolean result = Command .withParams (params ).execute ();
641641 assertTrue (result , "Failed to create domain.yaml" );
642642
643+ // For the domain created by WLST, we have to apply domain.yaml created by update-domain.sh
644+ // before initiating introspection of the domain to start the second cluster that was just added
645+ // otherwise the newly added Cluster 'cluster-2' is not added to the domain1.
646+ if (script .equals ("wlst" )) {
647+ // run kubectl to update the domain
648+ logger .info ("Run kubectl to create the domain" );
649+ params = new CommandParams ().defaults ();
650+ params .command ("kubectl apply -f "
651+ + Paths .get (sampleBase .toString (), "weblogic-domains/"
652+ + domainName
653+ + "/domain.yaml" ).toString ());
654+
655+ result = Command .withParams (params ).execute ();
656+ assertTrue (result , "Failed to create domain custom resource" );
657+ }
658+
643659 // Have to initiate introspection of the domain to start the second cluster that was just added
644660 // Call introspectDomain.sh
645661 String extraParams = " -d " + domainName + " -n " + domainNamespace ;
0 commit comments