public InfluxDBContainer(final String version) { super(IMAGE_NAME + ":" + version); waitStrategy = new WaitAllStrategy() .withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204)) .withStrategy(Wait.forListeningPort()); }
/** * Waits for the given status code. * * @param statusCode the expected status code * @return this */ public HttpWaitStrategy forStatusCode(int statusCode) { delegateStrategy.forStatusCode(statusCode); return this; }
public PulsarContainer(String pulsarVersion) { super(TestcontainersConfiguration.getInstance().getPulsarImage() + ":" + pulsarVersion); withExposedPorts(BROKER_PORT, BROKER_HTTP_PORT); withCommand("/pulsar/bin/pulsar", "standalone", "--no-functions-worker", "-nss"); waitingFor(Wait.forHttp(METRICS_ENDPOINT).forStatusCode(200).forPort(BROKER_HTTP_PORT)); }
/** * Convenience method to return a WaitStrategy for an HTTP endpoint. * * @param path the path to check * @return the WaitStrategy * @see HttpWaitStrategy */ public static HttpWaitStrategy forHttp(String path) { return new HttpWaitStrategy() .forPath(path); }
/** * Convenience method to return a WaitStrategy for log messages. * * @param regex the regex pattern to check for * @param times the number of times the pattern is expected * @return LogMessageWaitStrategy */ public static LogMessageWaitStrategy forLogMessage(String regex, int times) { return new LogMessageWaitStrategy().withRegEx(regex).withTimes(times); }
/** * Convenience method to return a WaitStrategy for an exposed or mapped port. * * @return the WaitStrategy * @see HostPortWaitStrategy */ public static HostPortWaitStrategy forListeningPort() { return new HostPortWaitStrategy(); }
/** * Convenience method to return the default WaitStrategy. * * @return a WaitStrategy */ public static WaitStrategy defaultWaitStrategy() { return forListeningPort(); }
/** * Authenticate with HTTP Basic Authorization credentials. * * @param username the username * @param password the password * @return this */ public HttpWaitStrategy withBasicCredentials(String username, String password) { delegateStrategy.withBasicCredentials(username, password); return this; }
/** * Waits for the response to pass the given predicate * @param responsePredicate The predicate to test the response against * @return this */ public HttpWaitStrategy forResponsePredicate(Predicate<String> responsePredicate) { delegateStrategy.forResponsePredicate(responsePredicate); return this; }
@Override protected void waitUntilReady() { delegateStrategy.waitUntilReady(this.waitStrategyTarget); } }
/** * Waits for the given path. * * @param path the path to check * @return this */ public HttpWaitStrategy forPath(String path) { delegateStrategy.forPath(path); return this; }
public LogMessageWaitStrategy withTimes(int times) { delegateWaitStrategy.withTimes(times); return this; } }
@Override protected void waitUntilReady() { delegateWaitStrategy.waitUntilReady(this.waitStrategyTarget); }
public LogMessageWaitStrategy withRegEx(String regEx) { delegateWaitStrategy.withRegEx(regEx); return this; }
/** * Convenience method to return a WaitStrategy leveraging Docker's built-in healthcheck. * * @return DockerHealthcheckWaitStrategy */ public static DockerHealthcheckWaitStrategy forHealthcheck() { return new DockerHealthcheckWaitStrategy(); } }
/** * @return the ports on which to check if the container is ready */ protected Set<Integer> getLivenessCheckPorts() { return waitStrategyTarget.getLivenessCheckPortNumbers(); }
/** * Indicates that the status check should use HTTPS. * * @return this */ public HttpWaitStrategy usingTls() { delegateStrategy.usingTls(); return this; }
@Override protected void waitUntilReady() { delegateStrategy.waitUntilReady(this.waitStrategyTarget); }
/** * Wait until {@link #waitStrategyTarget} has started. */ protected abstract void waitUntilReady();