-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: Upgraded to latest testcontainers-redis
- Loading branch information
Showing
4 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...dis-enterprise-admin/src/test/java/com/redis/enterprise/TestRedisEnterpriseContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.redis.enterprise; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
import com.redis.testcontainers.AbstractRedisEnterpriseContainer; | ||
|
||
public class TestRedisEnterpriseContainer extends AbstractRedisEnterpriseContainer<TestRedisEnterpriseContainer> { | ||
|
||
private final Admin admin = new Admin(); | ||
private Database database = Database.builder().shardCount(2).port(12000).ossCluster(true) | ||
.modules(RedisModule.SEARCH, RedisModule.JSON, RedisModule.TIMESERIES, RedisModule.BLOOM).build(); | ||
|
||
private static final Logger log = LoggerFactory.getLogger(TestRedisEnterpriseContainer.class); | ||
|
||
public TestRedisEnterpriseContainer(String dockerImageName) { | ||
super(dockerImageName); | ||
} | ||
|
||
public TestRedisEnterpriseContainer(DockerImageName dockerImageName) { | ||
super(dockerImageName); | ||
} | ||
|
||
@Override | ||
protected String getAdminUserName() { | ||
return admin.getUserName(); | ||
} | ||
|
||
@Override | ||
protected String getAdminPassword() { | ||
return admin.getPassword(); | ||
} | ||
|
||
@Override | ||
public int getRedisPort() { | ||
return database.getPort(); | ||
} | ||
|
||
@Override | ||
public boolean isRedisCluster() { | ||
return database.isOssCluster(); | ||
} | ||
|
||
@Override | ||
protected void doStart() { | ||
admin.withHost(getHost()); | ||
addFixedExposedPort(admin.getPort(), admin.getPort()); | ||
addFixedExposedPort(database.getPort(), database.getPort()); | ||
super.doStart(); | ||
} | ||
|
||
@Override | ||
protected void createCluster() throws Exception { | ||
log.info("Waiting for cluster bootstrap"); | ||
admin.waitForBoostrap(); | ||
super.createCluster(); | ||
Database response = admin.createDatabase(database); | ||
log.info("Created database {} with UID {}", response.getName(), response.getUid()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters