@@ -245,14 +245,46 @@ public void testDomainInitContainerNegative() throws Exception {
245
245
}
246
246
247
247
/**
248
- * Add initContainers at domain and admin server level and verify init container run only at
249
- * domain level
248
+ * Add initContainers at domain and admin server level and verify init container runs at both
249
+ * level when the names are different
250
250
*
251
251
* @throws Exception when domain.yaml cannot be read or modified to include the initContainers or
252
252
* weblogic server pod doesn't go through initialization and ready state
253
253
*/
254
254
@ Test
255
- public void testInitContainerDiffLevel () throws Exception {
255
+ public void testInitContainerDiffLevelDiffName () throws Exception {
256
+ Assume .assumeFalse (QUICKTEST );
257
+ String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
258
+ logTestBegin (testMethodName );
259
+ String pods [] = {domainUid + "-" + domain .getAdminServerName (), domainUid + "-managed-server2" };
260
+
261
+ // Modify the original domain yaml to include restartVersion in admin server node
262
+ DomainCrd crd = new DomainCrd (originalYaml );
263
+ crd .addInitContNode ("spec" , null , null , "busybox1" , "sleep" );
264
+ crd .addInitContNode ("adminServer" , null , null , "busybox2" , "sleep" );
265
+ String modYaml = crd .getYamlTree ();
266
+ logger .info (modYaml );
267
+ testInitContainer (modYaml );
268
+ String cmd = "kubectl get pod " + pods [0 ] + " -n " + domain .getDomainNs ();
269
+
270
+ TestUtils .checkCmdInLoop (cmd , "Init:0/2" , pods [0 ]);
271
+ TestUtils .checkCmdInLoop (cmd , "Init:1/2" , pods [0 ]);
272
+ TestUtils .checkPodReady (pods [0 ], domain .getDomainNs ());
273
+
274
+ logger .info ("Verifying if the pods are recreated with initialization" );
275
+ verifyPodInitialized (pods [1 ]);
276
+ logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
277
+ }
278
+
279
+ /**
280
+ * Add initContainers at domain and admin server level and verify init container is not run at
281
+ * both level when the names are same
282
+ *
283
+ * @throws Exception when domain.yaml cannot be read or modified to include the initContainers or
284
+ * weblogic server pod doesn't go through initialization and ready state
285
+ */
286
+ @ Test
287
+ public void testInitContainerDiffLevelSameName () throws Exception {
256
288
Assume .assumeFalse (QUICKTEST );
257
289
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
258
290
logTestBegin (testMethodName );
@@ -261,7 +293,7 @@ public void testInitContainerDiffLevel() throws Exception {
261
293
// Modify the original domain yaml to include restartVersion in admin server node
262
294
DomainCrd crd = new DomainCrd (originalYaml );
263
295
crd .addInitContNode ("spec" , null , null , "busybox" , "sleep" );
264
- crd .addInitContNode ("adminServer" , null , null , "busybox1 " , "foo" );
296
+ crd .addInitContNode ("adminServer" , null , null , "busybox " , "foo" );
265
297
String modYaml = crd .getYamlTree ();
266
298
logger .info (modYaml );
267
299
testInitContainer (modYaml );
@@ -271,7 +303,6 @@ public void testInitContainerDiffLevel() throws Exception {
271
303
}
272
304
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
273
305
}
274
-
275
306
/**
276
307
* Add multiple initContainers at domain level and verify all of the init containers are run
277
308
*
0 commit comments