@@ -124,14 +124,18 @@ public void testDomainInitContainer() throws Exception {
124
124
Assume .assumeFalse (QUICKTEST );
125
125
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
126
126
logTestBegin (testMethodName );
127
- String podName = domainUid + "-" + domain .getAdminServerName ();
127
+ String pods [] = { domainUid + "-" + domain .getAdminServerName (), domainUid + "-managed-server1" } ;
128
128
129
129
// Modify the original domain yaml to include restartVersion in admin server node
130
130
DomainCrd crd = new DomainCrd (originalYaml );
131
131
crd .addInitContNode ("spec" , null , null );
132
132
String modYaml = crd .getYamlTree ();
133
133
logger .info (modYaml );
134
- testInitContainer (modYaml , podName );
134
+ testInitContainer (modYaml );
135
+ for (String pod : pods ) {
136
+ logger .info ("Verifying if the pods are recreated with initialization" );
137
+ verifyPodInitialized (pod );
138
+ }
135
139
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
136
140
}
137
141
@@ -147,14 +151,16 @@ public void testAdminServerInitContainer() throws Exception {
147
151
Assume .assumeFalse (QUICKTEST );
148
152
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
149
153
logTestBegin (testMethodName );
150
- String podName = domainUid + "-" + domain .getAdminServerName ();
154
+ String adminPodName = domainUid + "-" + domain .getAdminServerName ();
151
155
152
156
// Modify the original domain yaml to include restartVersion in admin server node
153
157
DomainCrd crd = new DomainCrd (originalYaml );
154
158
crd .addInitContNode ("adminServer" , null , null );
155
159
String modYaml = crd .getYamlTree ();
156
160
logger .info (modYaml );
157
- testInitContainer (modYaml , podName );
161
+ testInitContainer (modYaml );
162
+ logger .info ("Verifying if the admin server pod is recreated with initialization" );
163
+ verifyPodInitialized (adminPodName );
158
164
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
159
165
}
160
166
@@ -170,14 +176,18 @@ public void testClusterInitContainer() throws Exception {
170
176
Assume .assumeFalse (QUICKTEST );
171
177
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
172
178
logTestBegin (testMethodName );
173
- String podName = domainUid + "-" + domain .getAdminServerName ();
179
+ String adminPodName = domainUid + "-" + domain .getAdminServerName ();
180
+ String ms2PodName = domainUid + "-managed-server2" ;
174
181
175
182
// Modify the original domain yaml to include restartVersion in admin server node
176
183
DomainCrd crd = new DomainCrd (originalYaml );
177
184
crd .addInitContNode ("clusters" , "cluster-1" , null );
178
185
String modYaml = crd .getYamlTree ();
179
186
logger .info (modYaml );
180
- testInitContainer (modYaml , podName );
187
+ testInitContainer (modYaml );
188
+ TestUtils .checkPodReady (adminPodName , domain .getDomainNs ());
189
+ logger .info ("Verifying if the managed server pods are recreated with initialization" );
190
+ verifyPodInitialized (ms2PodName );
181
191
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
182
192
}
183
193
@@ -193,14 +203,18 @@ public void testMSInitContainer() throws Exception {
193
203
Assume .assumeFalse (QUICKTEST );
194
204
String testMethodName = new Object () {}.getClass ().getEnclosingMethod ().getName ();
195
205
logTestBegin (testMethodName );
196
- String podName = domainUid + "-" + domain .getAdminServerName ();
206
+ String adminPodName = domainUid + "-" + domain .getAdminServerName ();
207
+ String ms1PodName = domainUid + "-managed-server1" ;
197
208
198
209
// Modify the original domain yaml to include restartVersion in admin server node
199
210
DomainCrd crd = new DomainCrd (originalYaml );
200
211
crd .addInitContNode ("managedServers" , "cluster-1" , "managed-server1" );
201
212
String modYaml = crd .getYamlTree ();
202
213
logger .info (modYaml );
203
- testInitContainer (modYaml , podName );
214
+ testInitContainer (modYaml );
215
+ TestUtils .checkPodReady (adminPodName , domain .getDomainNs ());
216
+ logger .info ("Verifying if the managed server pod is recreated with initialization" );
217
+ verifyPodInitialized (ms1PodName );
204
218
logger .log (Level .INFO , "SUCCESS - {0}" , testMethodName );
205
219
}
206
220
@@ -211,7 +225,7 @@ public void testMSInitContainer() throws Exception {
211
225
* @throws Exception when domain.yaml cannot be read or modified to include the initContainers or
212
226
* weblogic server pod doesn't go through initialization and ready state
213
227
*/
214
- private void testInitContainer (String modYaml , String podName ) throws Exception {
228
+ private void testInitContainer (String modYaml ) throws Exception {
215
229
// Write the modified yaml to a new file
216
230
Path path = Paths .get (initContainerTmpDir , "domain.yaml" );
217
231
logger .log (Level .INFO , "Path of the modified domain.yaml :{0}" , path .toString ());
@@ -224,9 +238,6 @@ private void testInitContainer(String modYaml, String podName) throws Exception
224
238
logger .log (Level .INFO , "kubectl apply -f {0}" , path .toString ());
225
239
ExecResult exec = TestUtils .exec ("kubectl apply -f " + path .toString ());
226
240
logger .info (exec .stdout ());
227
-
228
- logger .info ("Verifying if the server pod is recreated with initialization" );
229
- verifyPodInitialized (podName );
230
241
}
231
242
232
243
/**
@@ -236,12 +247,7 @@ private void testInitContainer(String modYaml, String podName) throws Exception
236
247
* @throws Exception when pod doesn't go through the initialization and ready state
237
248
*/
238
249
private void verifyPodInitialized (String podName ) throws Exception {
239
- for (int i = 0 ; i < 30 ; i ++) {
240
- Thread .sleep (1000 * 10 );
241
- TestUtils .exec ("kubectl get all --all-namespaces" , true );
242
- }
243
-
244
- // TestUtils.checkPodInitializing(podName, domain.getDomainNs());
245
- // TestUtils.checkPodReady(podName, domain.getDomainNs());
250
+ TestUtils .checkPodInitializing (podName , domain .getDomainNs ());
251
+ TestUtils .checkPodReady (podName , domain .getDomainNs ());
246
252
}
247
253
}
0 commit comments