|
108 | 108 | import static oracle.weblogic.kubernetes.utils.FileUtils.copyFileToPod;
|
109 | 109 | import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
|
110 | 110 | import static org.awaitility.Awaitility.with;
|
111 |
| -import static org.junit.jupiter.api.Assertions.assertAll; |
112 | 111 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
113 | 112 | import static org.junit.jupiter.api.Assertions.assertFalse;
|
114 | 113 | import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
@@ -273,19 +272,21 @@ public void testMiiServerLogsAreOnPV() {
|
273 | 272 | public void testMiiHttpServerLogsAreOnPV() {
|
274 | 273 | String[] podNames = {managedServerPrefix + "1", managedServerPrefix + "2"};
|
275 | 274 | for (String pod : podNames) {
|
276 |
| - String curlCmd = "for i in {1..100}; do curl -v " |
277 |
| - + "http://" + pod + ":8001/sample-war/index.jsp; done"; |
278 |
| - logger.info("Command to send HTTP request and get HTTP response {0} ", curlCmd); |
279 |
| - ExecResult execResult = assertDoesNotThrow(() -> execCommand(domainNamespace, pod, null, true, |
280 |
| - "/bin/sh", "-c", curlCmd)); |
281 |
| - if (execResult.exitValue() == 0) { |
282 |
| - logger.info("\n HTTP response is \n " + execResult.toString()); |
283 |
| - assertAll("Check that the HTTP response is 200", |
284 |
| - () -> assertTrue(execResult.toString().contains("HTTP/1.1 200 OK")) |
285 |
| - ); |
286 |
| - } else { |
287 |
| - fail("Failed to access sample application " + execResult.stderr()); |
288 |
| - } |
| 275 | + String curlCmd = "for i in {1..100}; " |
| 276 | + + "do " |
| 277 | + + "curl -v http://" + pod + ":8001/sample-war/index.jsp;" |
| 278 | + + "done"; |
| 279 | + withStandardRetryPolicy |
| 280 | + .conditionEvaluationListener( |
| 281 | + condition -> logger.info("Sending HTTP requests to populate the http access log " |
| 282 | + + "(elapsed time {0} ms, remaining time {1} ms)", |
| 283 | + condition.getElapsedTimeInMS(), |
| 284 | + condition.getRemainingTimeInMS())) |
| 285 | + .until((Callable<Boolean>) () -> { |
| 286 | + ExecResult execResult = assertDoesNotThrow(() -> execCommand(domainNamespace, pod, null, true, |
| 287 | + "/bin/sh", "-c", curlCmd)); |
| 288 | + return execResult.toString().contains("HTTP/1.1 200 OK"); |
| 289 | + }); |
289 | 290 | }
|
290 | 291 | String[] servers = {"managed-server1", "managed-server2"};
|
291 | 292 | for (String server : servers) {
|
|
0 commit comments