Skip to content

Commit d04284d

Browse files
committed
Merge branch 'app-access-42.2' into 'release/4.2'
[intermittent][OKE]ItLBTwoDomainsNginx, ItLBTwoDomainsTraefic, ItConfigDistributionStrategy tests failing while trying to access WLS server or application See merge request weblogic-cloud/weblogic-kubernetes-operator!4857
2 parents 54c796a + 80d2557 commit d04284d

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ApplicationUtils.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.nio.file.Paths;
99
import java.util.HashMap;
1010
import java.util.List;
11+
import java.util.concurrent.Callable;
1112

1213
import oracle.weblogic.kubernetes.logging.LoggingFacade;
1314
import org.awaitility.core.ConditionFactory;
@@ -350,6 +351,34 @@ public static boolean callWebAppAndCheckForServerNameInResponse(
350351
return false;
351352
}
352353

354+
/**
355+
* Call a web app and wait for the response code 200.
356+
* @param curlCmd curl command to call the web app
357+
* @return true if 200 response code is returned, false otherwise
358+
*/
359+
public static Callable<Boolean> callWebAppAndWaitTillReady(String curlCmd) {
360+
LoggingFacade logger = getLogger();
361+
String httpStatusCode = "200";
362+
363+
return () -> {
364+
final ExecResult result = ExecCommand.exec(curlCmd);
365+
final String responseCode = result.stdout().trim();
366+
367+
if (result != null) {
368+
logger.info("result.stdout: \n{0}", result.stdout());
369+
logger.info("result.stderr: \n{0}", result.stderr());
370+
logger.info("result.exitValue: \n{0}", result.exitValue());
371+
}
372+
373+
if (result.exitValue() != 0 || !responseCode.equals(httpStatusCode)) {
374+
logger.info("callWebApp did not return {0} response code, got {1}", httpStatusCode, responseCode);
375+
return false;
376+
}
377+
378+
return true;
379+
};
380+
}
381+
353382
/**
354383
* Call a web app and wait for the response code 200.
355384
* @param curlCmd curl command to call the web app

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonLBTestUtils.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,12 @@ public static void verifyAdminServerAccess(boolean isTLS,
913913
consoleAccessible = true;
914914
break;
915915
}
916+
917+
try {
918+
Thread.sleep(5000);
919+
} catch (InterruptedException ignore) {
920+
// ignore
921+
}
916922
} catch (IOException | InterruptedException ex) {
917923
getLogger().severe(ex.getMessage());
918924
}

integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/LoadBalancerUtils.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.checkServiceExists;
7272
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getHostAndPort;
7373
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.testUntil;
74-
//import static oracle.weblogic.kubernetes.utils.CommonTestUtils.verifyCommandResultContainsMsg;
74+
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.withLongRetryPolicy;
7575
import static oracle.weblogic.kubernetes.utils.ExecCommand.exec;
7676
import static oracle.weblogic.kubernetes.utils.ImageUtils.createTestRepoSecret;
7777
import static oracle.weblogic.kubernetes.utils.ThreadSafeLogger.getLogger;
@@ -743,6 +743,11 @@ public static void createNginxIngressPathRoutingRules(String domainNamespace,
743743
+ "/weblogic/ready --write-out %{http_code} -o /dev/null";
744744

745745
logger.info("Executing curl command {0}", curlCmd);
746+
testUntil(
747+
withLongRetryPolicy,
748+
callWebAppAndWaitTillReady(curlCmd),
749+
logger,
750+
"Waiting until Web App available");
746751
assertTrue(callWebAppAndWaitTillReady(curlCmd, 60));
747752
}
748753

0 commit comments

Comments
 (0)