Skip to content

Commit 8087fc5

Browse files
committed
remove debug code
1 parent 124bf41 commit 8087fc5

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/ItInitContainers.java

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,18 @@ public void testDomainInitContainer() throws Exception {
124124
Assume.assumeFalse(QUICKTEST);
125125
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
126126
logTestBegin(testMethodName);
127-
String podName = domainUid + "-" + domain.getAdminServerName();
127+
String pods[] = {domainUid + "-" + domain.getAdminServerName(), domainUid + "-managed-server1"};
128128

129129
// Modify the original domain yaml to include restartVersion in admin server node
130130
DomainCrd crd = new DomainCrd(originalYaml);
131131
crd.addInitContNode("spec", null, null);
132132
String modYaml = crd.getYamlTree();
133133
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+
}
135139
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
136140
}
137141

@@ -147,14 +151,16 @@ public void testAdminServerInitContainer() throws Exception {
147151
Assume.assumeFalse(QUICKTEST);
148152
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
149153
logTestBegin(testMethodName);
150-
String podName = domainUid + "-" + domain.getAdminServerName();
154+
String adminPodName = domainUid + "-" + domain.getAdminServerName();
151155

152156
// Modify the original domain yaml to include restartVersion in admin server node
153157
DomainCrd crd = new DomainCrd(originalYaml);
154158
crd.addInitContNode("adminServer", null, null);
155159
String modYaml = crd.getYamlTree();
156160
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);
158164
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
159165
}
160166

@@ -170,14 +176,18 @@ public void testClusterInitContainer() throws Exception {
170176
Assume.assumeFalse(QUICKTEST);
171177
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
172178
logTestBegin(testMethodName);
173-
String podName = domainUid + "-" + domain.getAdminServerName();
179+
String adminPodName = domainUid + "-" + domain.getAdminServerName();
180+
String ms2PodName = domainUid + "-managed-server2";
174181

175182
// Modify the original domain yaml to include restartVersion in admin server node
176183
DomainCrd crd = new DomainCrd(originalYaml);
177184
crd.addInitContNode("clusters", "cluster-1", null);
178185
String modYaml = crd.getYamlTree();
179186
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);
181191
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
182192
}
183193

@@ -193,14 +203,18 @@ public void testMSInitContainer() throws Exception {
193203
Assume.assumeFalse(QUICKTEST);
194204
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
195205
logTestBegin(testMethodName);
196-
String podName = domainUid + "-" + domain.getAdminServerName();
206+
String adminPodName = domainUid + "-" + domain.getAdminServerName();
207+
String ms1PodName = domainUid + "-managed-server1";
197208

198209
// Modify the original domain yaml to include restartVersion in admin server node
199210
DomainCrd crd = new DomainCrd(originalYaml);
200211
crd.addInitContNode("managedServers", "cluster-1", "managed-server1");
201212
String modYaml = crd.getYamlTree();
202213
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);
204218
logger.log(Level.INFO, "SUCCESS - {0}", testMethodName);
205219
}
206220

@@ -211,7 +225,7 @@ public void testMSInitContainer() throws Exception {
211225
* @throws Exception when domain.yaml cannot be read or modified to include the initContainers or
212226
* weblogic server pod doesn't go through initialization and ready state
213227
*/
214-
private void testInitContainer(String modYaml, String podName) throws Exception {
228+
private void testInitContainer(String modYaml) throws Exception {
215229
// Write the modified yaml to a new file
216230
Path path = Paths.get(initContainerTmpDir, "domain.yaml");
217231
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
224238
logger.log(Level.INFO, "kubectl apply -f {0}", path.toString());
225239
ExecResult exec = TestUtils.exec("kubectl apply -f " + path.toString());
226240
logger.info(exec.stdout());
227-
228-
logger.info("Verifying if the server pod is recreated with initialization");
229-
verifyPodInitialized(podName);
230241
}
231242

232243
/**
@@ -236,12 +247,7 @@ private void testInitContainer(String modYaml, String podName) throws Exception
236247
* @throws Exception when pod doesn't go through the initialization and ready state
237248
*/
238249
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());
246252
}
247253
}

0 commit comments

Comments
 (0)