diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DbUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DbUtils.java index 1534678326e..fa3b5bb0ebc 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DbUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DbUtils.java @@ -281,6 +281,12 @@ public static synchronized void startOracleDB(String dbBaseImageName, int dbPort } // wait for the Oracle DB pod to be ready + testUntil( + assertDoesNotThrow(() -> checkDBPodNameReady(dbNamespace, dbPodNamePrefix), + String.format("DB pod %s is not ready yet in namespace %s", dbPodNamePrefix, dbNamespace)), + logger, + "Oracle DB pod to be ready in namespace {0}", dbNamespace); + String dbPodName = assertDoesNotThrow(() -> getPodNameOfDb(dbNamespace, dbPodNamePrefix), String.format("Get Oracle DB pod name failed with ApiException for oracleDBService in namespace %s", dbNamespace)); @@ -301,6 +307,17 @@ public static synchronized void startOracleDB(String dbBaseImageName, int dbPort dbMap.put(dbNamespace, dbPodName); } + private static Callable checkDBPodNameReady(String dbNamespace, String dbPodNamePrefix) { + return (() -> { + // wait for the Oracle DB pod to be ready + String dbPodName = assertDoesNotThrow(() -> getPodNameOfDb(dbNamespace, dbPodNamePrefix), + String.format("Get Oracle DB pod name failed with ApiException for oracleDBService in namespace %s", + dbNamespace)); + + return (dbPodName != null); + }); + } + /** * Create a RCU schema in the namespace. *