@@ -168,7 +168,6 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
168168 * Create a basic FMW domain on PV.
169169 * Operator will create PV/PVC/RCU/Domain.
170170 * 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.
172171 */
173172 @ Test
174173 @ DisabledIfEnvironmentVariable (named = "OKD" , matches = "true" )
@@ -254,42 +253,6 @@ void testOperatorCreatesPvPvcRcuDomain() {
254253 // verify that all servers are ready
255254 verifyDomainReady (domainNamespace , domainUid , replicaCount , "nosuffix" );
256255
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 ));
293256 } finally {
294257 // delete the domain
295258 deleteDomainResource (domainNamespace , domainUid );
@@ -304,6 +267,7 @@ void testOperatorCreatesPvPvcRcuDomain() {
304267 * Create a basic FMW domain on PV.
305268 * User creates PV/PVC, operator creates RCU and domain.
306269 * 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.
307271 */
308272 @ Test
309273 @ DisplayName ("Create a FMW domain on PV. User creates PV/PVC and operator creates RCU and domain" )
@@ -384,6 +348,8 @@ void testUserCreatesPvPvcOperatorCreatesRcuDomain() {
384348
385349 // verify that all servers are ready
386350 verifyDomainReady (domainNamespace , domainUid , replicaCount , "nosuffix" );
351+
352+ verifyRollingRestartWithImageChg (domainUid , domainNamespace );
387353 } finally {
388354 // delete the domain
389355 deleteDomainResource (domainNamespace , domainUid );
@@ -820,4 +786,43 @@ private Callable<Boolean> tagImageAndPushIfNeeded(String originalImage, String t
820786 return result ;
821787 });
822788 }
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+ }
823828}
0 commit comments