Skip to content

Commit 2bfbd20

Browse files
authored
Remove the exitcode check and add retry (#2312)
* Validate the result when exitcode is not 0 * just check the http response code for the requests
1 parent b901019 commit 2bfbd20

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiUpdateDomainConfig.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@
108108
import static oracle.weblogic.kubernetes.utils.FileUtils.copyFileToPod;
109109
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
110110
import static org.awaitility.Awaitility.with;
111-
import static org.junit.jupiter.api.Assertions.assertAll;
112111
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
113112
import static org.junit.jupiter.api.Assertions.assertFalse;
114113
import static org.junit.jupiter.api.Assertions.assertNotEquals;
@@ -273,19 +272,21 @@ public void testMiiServerLogsAreOnPV() {
273272
public void testMiiHttpServerLogsAreOnPV() {
274273
String[] podNames = {managedServerPrefix + "1", managedServerPrefix + "2"};
275274
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+
});
289290
}
290291
String[] servers = {"managed-server1", "managed-server2"};
291292
for (String server : servers) {

0 commit comments

Comments
 (0)