private void addWaitStrategy(String serviceInstanceName, @NonNull WaitStrategy waitStrategy) { final WaitAllStrategy waitAllStrategy = waitStrategyMap.computeIfAbsent(serviceInstanceName, __ -> (WaitAllStrategy) new WaitAllStrategy().withStartupTimeout(Duration.ofMinutes(30))); waitAllStrategy.withStrategy(waitStrategy); }
private void waitUntilServiceStarted(String serviceName, ComposeServiceWaitStrategyTarget serviceInstance) { final WaitAllStrategy waitAllStrategy = waitStrategyMap.get(serviceName); if(waitAllStrategy != null) { waitAllStrategy.waitUntilReady(serviceInstance); } }
public InfluxDBContainer(final String version) { super(IMAGE_NAME + ":" + version); waitStrategy = new WaitAllStrategy() .withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204)) .withStrategy(Wait.forListeningPort()); }
public InfluxDBContainer(final String version) { super(IMAGE_NAME + ":" + version); waitStrategy = new WaitAllStrategy() .withStrategy(Wait.forHttp("/ping").withBasicCredentials(username, password).forStatusCode(204)) .withStrategy(Wait.forListeningPort()); }
/** * Creates a Testcontainer using a specific docker image. * * @param dockerImageName The docker image to use. */ public Neo4jContainer(String dockerImageName) { super(dockerImageName); WaitStrategy waitForBolt = new LogMessageWaitStrategy() .withRegEx(String.format(".*Bolt enabled on 0\\.0\\.0\\.0:%d\\.\n", DEFAULT_BOLT_PORT)); WaitStrategy waitForHttp = new HttpWaitStrategy() .forPort(DEFAULT_HTTP_PORT) .forStatusCodeMatching(response -> response == HTTP_OK); this.waitStrategy = new WaitAllStrategy() .withStrategy(waitForBolt) .withStrategy(waitForHttp) .withStartupTimeout(Duration.ofMinutes(2)); }
public DockerSwiftContainer() { this.swiftContainer = new GenericContainer<>(SWIFT_DOCKER_IMAGE); this.swiftContainer .withExposedPorts(KEYSTONE_ADMIN_PORT) .withExposedPorts(SWIFT_PORT) .withLogConsumer(DockerSwiftContainer::displayDockerLog) .waitingFor( new WaitAllStrategy() .withStrategy( forHttp("/v3") .forPort(KEYSTONE_ADMIN_PORT) .forStatusCode(200) .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND) ).withStrategy( forHttp("/info") .forPort(SWIFT_PORT) .forStatusCode(200) .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND) ) ); }
private void waitUntilServiceStarted(String serviceName, ComposeServiceWaitStrategyTarget serviceInstance) { final WaitAllStrategy waitAllStrategy = waitStrategyMap.get(serviceName); if (waitAllStrategy != null) { waitAllStrategy.waitUntilReady(serviceInstance); } }
private void addWaitStrategy(String serviceInstanceName, @NonNull WaitStrategy waitStrategy) { if (waitStrategy == null) { throw new java.lang.NullPointerException("waitStrategy is marked @NonNull but is null"); } final WaitAllStrategy waitAllStrategy = waitStrategyMap.computeIfAbsent(serviceInstanceName, __ -> (WaitAllStrategy) new WaitAllStrategy().withStartupTimeout(Duration.ofMinutes(30))); waitAllStrategy.withStrategy(waitStrategy); }
private static WaitStrategy getCompositeWaitStrategy(ElasticSearchProperties properties) { WaitAllStrategy strategy = new WaitAllStrategy() .withStrategy(new HostPortWaitStrategy()); properties.indices.forEach(index -> strategy.withStrategy(new CreateIndex(properties, index))); return strategy .withStrategy(new WaitForGreenStatus(properties)) .withStartupTimeout(DEFAULT_CONTAINER_WAIT_DURATION); } }
/** * https://developer.couchbase.com/documentation/server/current/rest-api/rest-node-provisioning.html */ private static WaitStrategy getCompositeWaitStrategy(CouchbaseProperties properties) { return new WaitAllStrategy() .withStrategy(new SetupNodeStorage(properties)) .withStrategy(new SetupRamQuotas(properties)) .withStrategy(new SetupServices(properties)) .withStrategy(new SetupIndexesType(properties)) .withStrategy(new SetupAdminUserAndPassword(properties)) .withStrategy(new CreateBucket(properties)) .withStrategy(new CreatePrimaryIndex(properties)) .withStrategy(new CreateBucketUser(properties)) .withStartupTimeout(DEFAULT_CONTAINER_WAIT_DURATION); } }
private WaitStrategy waitStrategy() { return new WaitAllStrategy() .withStrategy(Wait.forHttp("").forPort(DEFAULT_RABBITMQ_ADMIN_PORT) .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND) .withStartupTimeout(TEN_MINUTES_TIMEOUT)) .withStrategy(new RabbitMQWaitStrategy(this, TEN_MINUTES_TIMEOUT)) .withStartupTimeout(TEN_MINUTES_TIMEOUT); }
@Bean(name = AEROSPIKE_BEAN_NAME, destroyMethod = "stop") public GenericContainer aerospike(AerospikeWaitStrategy aerospikeWaitStrategy, ConfigurableEnvironment environment, AerospikeProperties properties) { log.info("Starting aerospike server. Docker image: {}", properties.dockerImage); WaitStrategy waitStrategy = new WaitAllStrategy() .withStrategy(aerospikeWaitStrategy) .withStrategy(new HostPortWaitStrategy()) .withStartupTimeout(Duration.of(60, SECONDS)); GenericContainer aerospike = new GenericContainer<>(properties.dockerImage) .withExposedPorts(properties.port) .withLogConsumer(containerLogsConsumer(log)) // see https://github.com/aerospike/aerospike-server.docker/blob/master/aerospike.template.conf .withEnv("NAMESPACE", properties.namespace) .withEnv("SERVICE_PORT", String.valueOf(properties.port)) .withEnv("MEM_GB", String.valueOf(1)) .withEnv("STORAGE_GB", String.valueOf(1)) .withCreateContainerCmdModifier(cmd -> cmd.withCapAdd(Capability.NET_ADMIN)) .waitingFor(waitStrategy) .withStartupTimeout(properties.getTimeoutDuration()); aerospike.start(); registerAerospikeEnvironment(aerospike, environment, properties); return aerospike; }