@@ -128,7 +128,7 @@ public void testDomainInitContainer() throws Exception {
128
128
129
129
// Modify the original domain yaml to include restartVersion in admin server node
130
130
DomainCrd crd = new DomainCrd (originalYaml );
131
- crd .addInitContNode ("spec" , null , null , "busybox" );
131
+ crd .addInitContNode ("spec" , null , null , "busybox" , "sleep" );
132
132
String modYaml = crd .getYamlTree ();
133
133
logger .info (modYaml );
134
134
testInitContainer (modYaml );
@@ -155,7 +155,7 @@ public void testAdminServerInitContainer() throws Exception {
155
155
156
156
// Modify the original domain yaml to include restartVersion in admin server node
157
157
DomainCrd crd = new DomainCrd (originalYaml );
158
- crd .addInitContNode ("adminServer" , null , null , "busybox" );
158
+ crd .addInitContNode ("adminServer" , null , null , "busybox" , "sleep" );
159
159
String modYaml = crd .getYamlTree ();
160
160
logger .info (modYaml );
161
161
testInitContainer (modYaml );
@@ -181,7 +181,7 @@ public void testClusterInitContainer() throws Exception {
181
181
182
182
// Modify the original domain yaml to include restartVersion in admin server node
183
183
DomainCrd crd = new DomainCrd (originalYaml );
184
- crd .addInitContNode ("clusters" , "cluster-1" , null , "busybox" );
184
+ crd .addInitContNode ("clusters" , "cluster-1" , null , "busybox" , "sleep" );
185
185
String modYaml = crd .getYamlTree ();
186
186
logger .info (modYaml );
187
187
testInitContainer (modYaml );
@@ -208,7 +208,7 @@ public void testMSInitContainer() throws Exception {
208
208
209
209
// Modify the original domain yaml to include restartVersion in admin server node
210
210
DomainCrd crd = new DomainCrd (originalYaml );
211
- crd .addInitContNode ("managedServers" , "cluster-1" , "managed-server1" , "busybox" );
211
+ crd .addInitContNode ("managedServers" , "cluster-1" , "managed-server1" , "busybox" , "sleep" );
212
212
String modYaml = crd .getYamlTree ();
213
213
logger .info (modYaml );
214
214
testInitContainer (modYaml );
@@ -230,23 +230,23 @@ public void testDomainInitContainerNegative() throws Exception {
230
230
Assume .assumeFalse (QUICKTEST );
231
231
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
232
232
logTestBegin (testMethodName );
233
- String pods [] = { domainUid + "-" + domain .getAdminServerName (), domainUid + "-managed-server1" } ;
233
+ String adminPodName = domainUid + "-" + domain .getAdminServerName ();
234
234
235
235
// Modify the original domain yaml to include restartVersion in admin server node
236
236
DomainCrd crd = new DomainCrd (originalYaml );
237
- crd .addInitContNode ("spec" , null , null , "busybox" );
237
+ crd .addInitContNode ("spec" , null , null , "busybox" , "sleep" );
238
238
String modYaml = crd .getYamlTree ();
239
239
modYaml = modYaml .replaceAll ("sleep" , "foo" );
240
240
logger .info (modYaml );
241
241
testInitContainer (modYaml );
242
- TestUtils . checkPodInitializing ( pods [ 0 ], domain .getDomainNs () );
243
- TestUtils .checkPodReady ( pods [ 0 ], domain . getDomainNs () );
242
+ String cmd = "kubectl get pod " + adminPodName + " -n " + domain .getDomainNs ();
243
+ TestUtils .checkCmdInLoop ( cmd , "Init:CrashLoopBackOff" , adminPodName );
244
244
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
245
245
}
246
246
247
247
/**
248
- * Add initContainers at domain and adminserver level and verify init containers are run at both
249
- * level
248
+ * Add initContainers at domain and admin server level and verify init container run only at
249
+ * domain level
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
@@ -256,23 +256,24 @@ public void testInitContainerDiffLevel() throws Exception {
256
256
Assume .assumeFalse (QUICKTEST );
257
257
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
258
258
logTestBegin (testMethodName );
259
- String pods [] = {domainUid + "-" + domain .getAdminServerName (), domainUid + "-managed-server1 " };
259
+ String pods [] = {domainUid + "-" + domain .getAdminServerName (), domainUid + "-managed-server2 " };
260
260
261
261
// Modify the original domain yaml to include restartVersion in admin server node
262
262
DomainCrd crd = new DomainCrd (originalYaml );
263
- crd .addInitContNode ("spec" , null , null , "busybox" );
264
- crd .addInitContNode ("adminServer" , null , null , "busybox1" );
263
+ crd .addInitContNode ("spec" , null , null , "busybox" , "sleep" );
264
+ crd .addInitContNode ("adminServer" , null , null , "busybox1" , "foo" );
265
265
String modYaml = crd .getYamlTree ();
266
266
logger .info (modYaml );
267
267
testInitContainer (modYaml );
268
- TestUtils .checkPodInitializing (pods [0 ], domain .getDomainNs ());
269
- TestUtils .checkPodReady (pods [0 ], domain .getDomainNs ());
268
+ for (String pod : pods ) {
269
+ logger .info ("Verifying if the pods are recreated with initialization" );
270
+ verifyPodInitialized (pod );
271
+ }
270
272
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
271
273
}
272
274
273
275
/**
274
- * Add initContainers at domain and adminserver level and verify init containers are run at both
275
- * level
276
+ * Add multiple initContainers at domain level and verify all of the init containers are run
276
277
*
277
278
* @throws Exception when domain.yaml cannot be read or modified to include the initContainers or
278
279
* weblogic server pod doesn't go through initialization and ready state
@@ -286,13 +287,17 @@ public void testInitContainerMultiple() throws Exception {
286
287
287
288
// Modify the original domain yaml to include restartVersion in admin server node
288
289
DomainCrd crd = new DomainCrd (originalYaml );
289
- crd .addInitContNode ("spec" , null , null , "busybox1" );
290
- crd .addInitContNode ("spec" , null , null , "busybox2" );
290
+ crd .addInitContNode ("spec" , null , null , "busybox1" , "sleep" );
291
+ crd .addInitContNode ("spec" , null , null , "busybox2" , "sleep" );
291
292
String modYaml = crd .getYamlTree ();
292
293
logger .info (modYaml );
293
294
testInitContainer (modYaml );
294
- TestUtils .checkPodInitializing (pods [0 ], domain .getDomainNs ());
295
- TestUtils .checkPodReady (pods [0 ], domain .getDomainNs ());
295
+ String cmd = "kubectl get pod " + pods [0 ] + " -n " + domain .getDomainNs ();
296
+ for (String pod : pods ) {
297
+ TestUtils .checkCmdInLoop (cmd , "Init:0/2" , pod );
298
+ TestUtils .checkCmdInLoop (cmd , "Init:1/2" , pod );
299
+ TestUtils .checkPodReady (pod , domain .getDomainNs ());
300
+ }
296
301
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
297
302
}
298
303
0 commit comments