Skip to content

Commit 3de993e

Browse files
committed
add terminate timeout on restart
1 parent e1a2628 commit 3de993e

File tree

1 file changed

+12
-2
lines changed
  • integration-tests/src/test/java/oracle/kubernetes/operator/utils

1 file changed

+12
-2
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,24 +1214,34 @@ public void verifyManagedServersRestarted() throws Exception {
12141214
podNameSet.add(managedServerNameBase + i);
12151215
}
12161216

1217-
// Loop until all the servers have recycled
1217+
// Loop until all the servers have recycled. Wait 5 minutes max for a managed server to be terminating.
12181218
//
1219+
final int MAX_TERMINATE_LOOP = 300;
1220+
int terminateLoopCount = 0;
12191221
while (podNameSet.size() > 0) {
12201222
Iterator<String> iter = podNameSet.iterator();
12211223
while (iter.hasNext()) {
12221224
String podName = iter.next();
12231225
if (TestUtils.checkPodTerminatingNoWait(domainUid + "-" + podName, domainNS)) {
1226+
terminateLoopCount = 0;
1227+
12241228
// Server is terminating, wait until server running then remove it from the list
1225-
logger.info("Managed server pod " + podName + " is terminating");
1229+
logger.info("Managed managed server pod " + podName + " is terminating, waiting until it is re-created and running.");
12261230
TestUtils.checkPodCreated(domainUid + "-" + podName, domainNS);
1231+
1232+
logger.info("Waiting until managed server pod " + podName + " is ready");
12271233
TestUtils.checkPodReady(domainUid + "-" + podName, domainNS);
1234+
12281235
logger.info("Managed server pod " + podName + " has been recycled");
12291236
iter.remove();
12301237
}
12311238
}
12321239
// We iterated through all the servers and if there are some remaining then
12331240
// Sleep and loop through the remaining ones again. Keep the sleep short so we don't miss the terminating status.
12341241
if (podNameSet.size() > 0) {
1242+
if (++terminateLoopCount > MAX_TERMINATE_LOOP) {
1243+
throw new RuntimeException("Timeout waiting for any managed server to terminate");
1244+
}
12351245
logger.info("Waiting for any managed server pod to be terminating...");
12361246
Thread.sleep(1000);
12371247
}

0 commit comments

Comments
 (0)