@@ -168,7 +168,6 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
168
168
* Create a basic FMW domain on PV.
169
169
* Operator will create PV/PVC/RCU/Domain.
170
170
* Verify Pod is ready and service exists for both admin server and managed servers.
171
- * Update the base image in the domain spec, verify the domain is rolling-restarted.
172
171
*/
173
172
@ Test
174
173
@ DisabledIfEnvironmentVariable (named = "OKD" , matches = "true" )
@@ -254,42 +253,6 @@ void testOperatorCreatesPvPvcRcuDomain() {
254
253
// verify that all servers are ready
255
254
verifyDomainReady (domainNamespace , domainUid , replicaCount , "nosuffix" );
256
255
257
- // get the map with server pods and their original creation timestamps
258
- String adminServerPodName = domainUid + "-admin-server" ;
259
- String managedServerPodNamePrefix = domainUid + "-managed-server" ;
260
- Map <String , OffsetDateTime > podsWithTimeStamps = getPodsWithTimeStamps (domainNamespace ,
261
- adminServerPodName , managedServerPodNamePrefix , replicaCount );
262
-
263
- // update the domain with new base image
264
- int index = FMWINFRA_IMAGE_TO_USE_IN_SPEC .lastIndexOf (":" );
265
- String newImage ;
266
- if (OCNE ) {
267
- newImage = BASE_IMAGES_PREFIX + "fmw-infrastructure1:newtag" ;
268
- } else {
269
- newImage = FMWINFRA_IMAGE_TO_USE_IN_SPEC .substring (0 , index ) + ":newtag" ;
270
- }
271
- testUntil (
272
- tagImageAndPushIfNeeded (FMWINFRA_IMAGE_TO_USE_IN_SPEC , newImage ),
273
- logger ,
274
- "tagImageAndPushIfNeeded for image {0} to be successful" ,
275
- newImage );
276
-
277
- logger .info ("patch the domain resource with new image {0}" , newImage );
278
- String patchStr
279
- = "["
280
- + "{\" op\" : \" replace\" , \" path\" : \" /spec/image\" , "
281
- + "\" value\" : \" " + newImage + "\" }"
282
- + "]" ;
283
- logger .info ("Updating domain configuration using patch string: {0}\n " , patchStr );
284
- V1Patch patch = new V1Patch (patchStr );
285
- assertTrue (patchDomainCustomResource (domainUid , domainNamespace , patch , V1Patch .PATCH_FORMAT_JSON_PATCH ),
286
- "Failed to patch domain" );
287
-
288
- // verify the server pods are rolling restarted and back to ready state
289
- logger .info ("Verifying rolling restart occurred for domain {0} in namespace {1}" ,
290
- domainUid , domainNamespace );
291
- assertTrue (verifyRollingRestartOccurred (podsWithTimeStamps , 1 , domainNamespace ),
292
- String .format ("Rolling restart failed for domain %s in namespace %s" , domainUid , domainNamespace ));
293
256
} finally {
294
257
// delete the domain
295
258
deleteDomainResource (domainNamespace , domainUid );
@@ -304,6 +267,7 @@ void testOperatorCreatesPvPvcRcuDomain() {
304
267
* Create a basic FMW domain on PV.
305
268
* User creates PV/PVC, operator creates RCU and domain.
306
269
* Verify Pod is ready and service exists for both admin server and managed servers.
270
+ * Update the base image in the domain spec, verify the domain is rolling-restarted.
307
271
*/
308
272
@ Test
309
273
@ DisplayName ("Create a FMW domain on PV. User creates PV/PVC and operator creates RCU and domain" )
@@ -384,6 +348,8 @@ void testUserCreatesPvPvcOperatorCreatesRcuDomain() {
384
348
385
349
// verify that all servers are ready
386
350
verifyDomainReady (domainNamespace , domainUid , replicaCount , "nosuffix" );
351
+
352
+ verifyRollingRestartWithImageChg (domainUid , domainNamespace );
387
353
} finally {
388
354
// delete the domain
389
355
deleteDomainResource (domainNamespace , domainUid );
@@ -820,4 +786,43 @@ private Callable<Boolean> tagImageAndPushIfNeeded(String originalImage, String t
820
786
return result ;
821
787
});
822
788
}
789
+
790
+ private void verifyRollingRestartWithImageChg (String domainUid , String domainNamespace ) {
791
+ // get the map with server pods and their original creation timestamps
792
+ String adminServerPodName = domainUid + "-admin-server" ;
793
+ String managedServerPodNamePrefix = domainUid + "-managed-server" ;
794
+ Map <String , OffsetDateTime > podsWithTimeStamps = getPodsWithTimeStamps (domainNamespace ,
795
+ adminServerPodName , managedServerPodNamePrefix , replicaCount );
796
+
797
+ // update the domain with new base image
798
+ int index = FMWINFRA_IMAGE_TO_USE_IN_SPEC .lastIndexOf (":" );
799
+ String newImage ;
800
+ if (OCNE ) {
801
+ newImage = BASE_IMAGES_PREFIX + "fmw-infrastructure1:newtag" ;
802
+ } else {
803
+ newImage = FMWINFRA_IMAGE_TO_USE_IN_SPEC .substring (0 , index ) + ":newtag" ;
804
+ }
805
+ testUntil (
806
+ tagImageAndPushIfNeeded (FMWINFRA_IMAGE_TO_USE_IN_SPEC , newImage ),
807
+ logger ,
808
+ "tagImageAndPushIfNeeded for image {0} to be successful" ,
809
+ newImage );
810
+
811
+ logger .info ("patch the domain resource with new image {0}" , newImage );
812
+ String patchStr
813
+ = "["
814
+ + "{\" op\" : \" replace\" , \" path\" : \" /spec/image\" , "
815
+ + "\" value\" : \" " + newImage + "\" }"
816
+ + "]" ;
817
+ logger .info ("Updating domain configuration using patch string: {0}\n " , patchStr );
818
+ V1Patch patch = new V1Patch (patchStr );
819
+ assertTrue (patchDomainCustomResource (domainUid , domainNamespace , patch , V1Patch .PATCH_FORMAT_JSON_PATCH ),
820
+ "Failed to patch domain" );
821
+
822
+ // verify the server pods are rolling restarted and back to ready state
823
+ logger .info ("Verifying rolling restart occurred for domain {0} in namespace {1}" ,
824
+ domainUid , domainNamespace );
825
+ assertTrue (verifyRollingRestartOccurred (podsWithTimeStamps , 1 , domainNamespace ),
826
+ String .format ("Rolling restart failed for domain %s in namespace %s" , domainUid , domainNamespace ));
827
+ }
823
828
}
0 commit comments