@@ -359,23 +359,26 @@ void testMiiCheckSystemResources() {
359
359
}
360
360
361
361
/**
362
- * Start a WebLogic domain using model-in-image with JMS/JDBC SystemResources.
363
- * Create a configmap to delete JMS/JDBC SystemResources.
362
+ * Start a WebLogic domain using model-in-image.
363
+ * Create 1 configmap with 2 models files, one of them to add JMS/JDBC SystemResources
364
+ * and another one to delete JMS/JDBC SystemResources
364
365
* Patch the domain resource with the configmap.
365
366
* Update the restart version of the domain resource.
366
367
* Verify rolling restart of the domain by comparing PodCreationTimestamp
367
368
* for all the server pods before and after rolling restart.
368
369
* Verify SystemResources are deleted from the domain.
369
370
*/
370
371
@ Test
371
- @ Order (4 )
372
+ @ Order (5 )
372
373
@ DisplayName ("Delete SystemResources from the domain" )
373
374
void testMiiDeleteSystemResources () {
374
375
375
376
String configMapName = "deletesysrescm" ;
377
+ final String modelFileAdd = "model.add.sysresources.yaml" ;
378
+ final String modelFileDelete = "model.delete.sysresources.yaml" ;
379
+ List <String > modelFiles = Arrays .asList (MODEL_DIR + "/" + modelFileAdd , MODEL_DIR + "/" + modelFileDelete );
376
380
createConfigMapAndVerify (
377
- configMapName , domainUid , domainNamespace ,
378
- Arrays .asList (MODEL_DIR + "/model.delete.sysresourcesbyconfigmap.yaml" ));
381
+ configMapName , domainUid , domainNamespace , modelFiles );
379
382
380
383
LinkedHashMap <String , OffsetDateTime > pods = new LinkedHashMap <>();
381
384
// get the creation time of the admin server pod before patching
@@ -433,7 +436,7 @@ void testMiiDeleteSystemResources() {
433
436
* Verify JMS Server logs are written on PV.
434
437
*/
435
438
@ Test
436
- @ Order (5 )
439
+ @ Order (6 )
437
440
@ DisplayName ("Add new JDBC/JMS SystemResources to the domain" )
438
441
void testMiiAddSystemResources () {
439
442
@@ -505,7 +508,7 @@ void testMiiAddSystemResources() {
505
508
* Verify servers from the new cluster are running.
506
509
*/
507
510
@ Test
508
- @ Order (6 )
511
+ @ Order (7 )
509
512
@ DisplayName ("Add a dynamic cluster to domain with non-zero replica count" )
510
513
void testMiiAddDynamicCluster () {
511
514
@@ -579,7 +582,7 @@ void testMiiAddDynamicCluster() {
579
582
* Check the validity of new credentials by accessing WebLogic RESTful Service
580
583
*/
581
584
@ Test
582
- @ Order (7 )
585
+ @ Order (8 )
583
586
@ DisplayName ("Change the WebLogic Admin credential of the domain" )
584
587
void testMiiUpdateWebLogicCredential () {
585
588
verifyUpdateWebLogicCredential (adminSvcExtHost , domainNamespace , domainUid , adminServerPodName ,
@@ -601,7 +604,7 @@ void testMiiUpdateWebLogicCredential() {
601
604
* Make sure JMS Connections and messages are distributed across 4 servers.
602
605
*/
603
606
@ Test
604
- @ Order (8 )
607
+ @ Order (9 )
605
608
@ DisplayName ("Test modification to Dynamic cluster size parameters" )
606
609
void testMiiUpdateDynamicClusterSize () {
607
610
@@ -745,6 +748,70 @@ private void buildClientOnPod() {
745
748
assertEquals (0 , result .exitValue (), "Client compilation fails" );
746
749
}
747
750
751
+ /**
752
+ * Start a WebLogic domain using model-in-image with JMS/JDBC SystemResources.
753
+ * Create a empty configmap to delete JMS/JDBC SystemResources
754
+ * Patch the domain resource with the configmap.
755
+ * Update the restart version of the domain resource.
756
+ * Verify rolling restart of the domain by comparing PodCreationTimestamp
757
+ * for all the server pods before and after rolling restart.
758
+ * Verify SystemResources are deleted from the domain.
759
+ */
760
+ @ Test
761
+ @ Order (4 )
762
+ @ DisplayName ("Delete SystemResources from the domain" )
763
+ void testMiiDeleteSystemResourcesByEmptyConfigMap () {
764
+
765
+ String configMapName = "deletesysrescm" ;
766
+ createConfigMapAndVerify (
767
+ configMapName , domainUid , domainNamespace ,
768
+ Arrays .asList (MODEL_DIR + "/model.delete.sysresourcesbyconfigmap.yaml" ));
769
+
770
+ LinkedHashMap <String , OffsetDateTime > pods = new LinkedHashMap <>();
771
+ // get the creation time of the admin server pod before patching
772
+ OffsetDateTime adminPodCreationTime = getPodCreationTime (domainNamespace ,adminServerPodName );
773
+ pods .put (adminServerPodName , adminPodCreationTime );
774
+ // get the creation time of the managed server pods before patching
775
+ for (int i = 1 ; i <= replicaCount ; i ++) {
776
+ pods .put (managedServerPrefix + i , getPodCreationTime (domainNamespace , managedServerPrefix + i ));
777
+ }
778
+
779
+ StringBuffer patchStr = null ;
780
+ patchStr = new StringBuffer ("[{" );
781
+ patchStr .append ("\" op\" : \" replace\" ," )
782
+ .append (" \" path\" : \" /spec/configuration/model/configMap\" ," )
783
+ .append (" \" value\" : \" " + configMapName + "\" " )
784
+ .append (" }]" );
785
+ logger .log (Level .INFO , "Configmap patch string: {0}" , patchStr );
786
+
787
+ patch = new V1Patch (new String (patchStr ));
788
+ boolean cmPatched = assertDoesNotThrow (() ->
789
+ patchDomainCustomResource (domainUid , domainNamespace , patch , "application/json-patch+json" ),
790
+ "patchDomainCustomResource(configMap) failed " );
791
+ assertTrue (cmPatched , "patchDomainCustomResource(configMap) failed" );
792
+
793
+ String newRestartVersion = patchDomainResourceWithNewRestartVersion (domainUid , domainNamespace );
794
+ logger .log (Level .INFO , "New restart version is {0}" , newRestartVersion );
795
+
796
+ assertTrue (verifyRollingRestartOccurred (pods , 1 , domainNamespace ),
797
+ "Rolling restart failed" );
798
+
799
+ // Even if pods are created, need the service to created
800
+ for (int i = 1 ; i <= replicaCount ; i ++) {
801
+ logger .info ("Check managed server service {0} created in namespace {1}" ,
802
+ managedServerPrefix + i , domainNamespace );
803
+ checkServiceExists (managedServerPrefix + i , domainNamespace );
804
+ }
805
+
806
+ int adminServiceNodePort
807
+ = getServiceNodePort (domainNamespace , getExternalServicePodName (adminServerPodName ), "default" );
808
+ assertNotEquals (-1 , adminServiceNodePort , "admin server default node port is not valid" );
809
+ verifySystemResourceConfiguration (adminSvcExtHost , adminServiceNodePort ,
810
+ "JDBCSystemResources" , "TestDataSource" , "404" );
811
+ verifySystemResourceConfiguration (adminSvcExtHost , adminServiceNodePort ,
812
+ "JMSSystemResources" , "TestClusterJmsModule" , "404" );
813
+ }
814
+
748
815
// Run standalone JMS Client in the pod using wlthint3client.jar in classpath.
749
816
// The client sends 300 messsage to a Uniform Distributed Queue.
750
817
// Make sure that each destination get excatly 150 messages each.
0 commit comments