|
61 | 61 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyTraefik;
|
62 | 62 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installAndVerifyVoyager;
|
63 | 63 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.installVoyagerIngressAndVerify;
|
| 64 | +import static oracle.weblogic.kubernetes.utils.CommonTestUtils.isVoyagerPodReady; |
64 | 65 | import static oracle.weblogic.kubernetes.utils.CommonTestUtils.setPodAntiAffinity;
|
65 | 66 | import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
|
66 | 67 | import static org.assertj.core.api.Assertions.assertThat;
|
@@ -202,12 +203,41 @@ public void testSameSessionStickinessUsingVoyager() {
|
202 | 203 | final String ingressName = domainUid + "-ingress-host-routing";
|
203 | 204 | final String ingressServiceName = VOYAGER_CHART_NAME + "-" + ingressName;
|
204 | 205 | final String channelName = "tcp-80";
|
| 206 | + final int maxRetry = 60; |
205 | 207 |
|
206 | 208 | // create Voyager ingress resource
|
207 | 209 | Map<String, Integer> clusterNameMsPortMap = new HashMap<>();
|
208 | 210 | clusterNameMsPortMap.put(clusterName, managedServerPort);
|
209 |
| - List<String> hostNames = |
210 |
| - installVoyagerIngressAndVerify(domainUid, domainNamespace, ingressName, clusterNameMsPortMap); |
| 211 | + |
| 212 | + List<String> hostNames = null; |
| 213 | + |
| 214 | + for (int i = 0; i < maxRetry; i++) { |
| 215 | + hostNames = |
| 216 | + installVoyagerIngressAndVerify(domainUid, domainNamespace, ingressName, clusterNameMsPortMap); |
| 217 | + |
| 218 | + if (hostNames != null && !hostNames.isEmpty()) { |
| 219 | + break; |
| 220 | + } |
| 221 | + |
| 222 | + try { |
| 223 | + // sometimes the ingress may not be ready even the condition check is ready, sleep a little bit |
| 224 | + Thread.sleep(1000); |
| 225 | + } catch (InterruptedException ignore) { |
| 226 | + // ignore |
| 227 | + } |
| 228 | + } |
| 229 | + |
| 230 | + withStandardRetryPolicy |
| 231 | + .conditionEvaluationListener( |
| 232 | + condition -> logger.info("Waiting for pod {0} to be created in namespace {1} " |
| 233 | + + "(elapsed time {2}ms, remaining time {3}ms)", |
| 234 | + ingressServiceName, |
| 235 | + domainNamespace, |
| 236 | + condition.getElapsedTimeInMS(), |
| 237 | + condition.getRemainingTimeInMS())) |
| 238 | + .until(assertDoesNotThrow(() -> isVoyagerPodReady(domainNamespace, ingressServiceName), |
| 239 | + String.format("podExists failed with ApiException for pod %s in namespace %s", |
| 240 | + ingressServiceName, domainNamespace))); |
211 | 241 |
|
212 | 242 | // get Voyager ingress service Nodeport
|
213 | 243 | int ingressServiceNodePort =
|
|
0 commit comments