@Override
    public void waitUntilReady(WaitStrategyTarget target) {
        YugabyteDBYSQLContainer container = (YugabyteDBYSQLContainer) target;
        retryUntilSuccess(
            (int) startupTimeout.getSeconds(),
            TimeUnit.SECONDS,
            () -> {
                getRateLimiter()
                    .doWhenReady(() -> {
                        try (Connection con = container.createConnection(""); Statement stmt = con.createStatement()) {
                            stmt.execute(YSQL_EXTENDED_PROBE);
                            stmt.execute(YSQL_EXTENDED_PROBE_DROP_TABLE);
                        } catch (SQLException ex) {
                            throw new RuntimeException(ex);
                        }
                    });
                return true;
            }
        );
    }
Custom wait strategy for YSQL API.

<p>
Though we can either use HTTP or PORT based wait strategy, when we create a custom
database/role, it gets executed asynchronously. As the wait on container.start() on a
specific port wouldn't fully guarantee the custom object execution. It's better to
check the DB status with this way with a smoke test query that uses the underlying
custom objects and wait for the operation to complete.
</p>
modules/yugabytedb/src/main/java/org/testcontainers/containers/strategy/YugabyteDBYSQLWaitStrategy.java