/** * 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 a WaitStrategy for an exposed or mapped port. * * @return the WaitStrategy * @see HostPortWaitStrategy */ public static HostPortWaitStrategy forListeningPort() { return new HostPortWaitStrategy(); }
private static SwarmGenericContainer fakeSmtpContainer() { return new SwarmGenericContainer(Images.FAKE_SMTP) .withAffinityToContainer() .waitingFor(new HostPortWaitStrategy() .withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)); }
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); } }
@Bean(name = DynamoDBProperties.BEAN_NAME_EMBEDDED_DYNAMODB, destroyMethod = "stop") public GenericContainer mariadb(ConfigurableEnvironment environment, DynamoDBProperties properties) throws Exception { log.info("Starting mariadb server. Docker image: {}", properties.dockerImage); GenericContainer mariadb = new GenericContainer(properties.dockerImage) .withLogConsumer(containerLogsConsumer(log)) .withExposedPorts(properties.port) .waitingFor(new HostPortWaitStrategy()) .withStartupTimeout(properties.getTimeoutDuration()); mariadb.start(); registerDynamodbEnvironment(mariadb, environment, properties); return mariadb; }
@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; }
private SwarmGenericContainer createContainer() { return new SwarmGenericContainer( new ImageFromDockerfile() .withFileFromClasspath("populate.ldif", "ldif-files/populate.ldif") .withFileFromClasspath("Dockerfile", "ldif-files/Dockerfile")) .withAffinityToContainer() .withEnv("SLAPD_DOMAIN", domain) .withEnv("SLAPD_PASSWORD", password) .withEnv("SLAPD_CONFIG_PASSWORD", password) .withExposedPorts(LdapGenericContainer.DEFAULT_LDAP_PORT) .waitingFor(new HostPortWaitStrategy().withRateLimiter(RateLimiters.TWENTIES_PER_SECOND)); } }