Skip to content

Commit e19609c

Browse files
committed
Review fixes
1 parent e45c6b1 commit e19609c

File tree

3 files changed

+14
-39
lines changed

3 files changed

+14
-39
lines changed

modules/ceph/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<groupId>com.amazonaws</groupId>
2525
<artifactId>aws-java-sdk-s3</artifactId>
2626
<version>1.11.231</version>
27+
<scope>provided</scope>
2728
</dependency>
2829
</dependencies>
2930

modules/ceph/src/main/java/org/testcontainers/containers/CephContainer.java

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
import com.amazonaws.auth.AWSStaticCredentialsProvider;
55
import com.amazonaws.auth.BasicAWSCredentials;
66
import com.amazonaws.client.builder.AwsClientBuilder;
7-
import org.testcontainers.containers.wait.LogMessageWaitStrategy;
7+
import lombok.AllArgsConstructor;
8+
import lombok.Getter;
9+
import org.testcontainers.containers.wait.HttpWaitStrategy;
810

911
import java.time.Duration;
1012

13+
@Getter
1114
public class CephContainer<SELF extends CephContainer<SELF>> extends GenericContainer<SELF> {
1215

1316
private static final String IMAGE = "ceph/demo";
@@ -24,10 +27,8 @@ public class CephContainer<SELF extends CephContainer<SELF>> extends GenericCont
2427

2528
private NetworkAutoDetectMode networkAutoDetectMode = NetworkAutoDetectMode.IPV4_ONLY;
2629

27-
private Duration startupTimeout = Duration.ofSeconds(20);
28-
2930
public CephContainer() {
30-
super(IMAGE + ":latest");
31+
super(IMAGE + ":tag-stable-3.0-jewel-ubuntu-16.04");
3132
}
3233

3334
public CephContainer(String dockerImageName) {
@@ -42,12 +43,13 @@ protected void configure() {
4243
withEnv("CEPH_DEMO_ACCESS_KEY", awsAccessKey);
4344
withEnv("CEPH_DEMO_SECRET_KEY", awsSecretKey);
4445
withEnv("CEPH_DEMO_BUCKET", bucketName);
45-
withExposedPorts(6789, 6800, 6801, 6802, 6803, 6804, 6805, 80, 5000);
46+
withExposedPorts(5000, 6789, 6800, 6801, 6802, 6803, 6804, 6805, 80);
4647
waitingFor(
47-
new LogMessageWaitStrategy()
48-
.withRegEx(".*\\/entrypoint.sh: SUCCESS\n")
49-
.withStartupTimeout(startupTimeout)
48+
new HttpWaitStrategy()
49+
.forPath("/api/v0.1/health")
50+
.forStatusCode(200)
5051
);
52+
withStartupTimeout(Duration.ofMinutes(5));
5153
}
5254

5355
public AWSCredentialsProvider getAWSCredentialsProvider() {
@@ -73,61 +75,34 @@ public SELF withAwsSecretKey(String awsSecretKey) {
7375
return self();
7476
}
7577

76-
public String getBucketName() {
77-
return bucketName;
78-
}
79-
8078
public SELF withBucketName(String bucketName) {
8179
//because s3cmd transforming bucket name to uppercase
8280
this.bucketName = bucketName.toUpperCase();
8381
return self();
8482
}
8583

86-
public String getRgwName() {
87-
return rgwName;
88-
}
89-
9084
public SELF withRgwName(String rgwName) {
9185
this.rgwName = rgwName;
9286
return self();
9387
}
9488

95-
public String getDemoUid() {
96-
return demoUid;
97-
}
98-
9989
public SELF withDemoUid(String demoUid) {
10090
this.demoUid = demoUid;
10191
return self();
10292
}
10393

104-
public NetworkAutoDetectMode getNetworkAutoDetectMode() {
105-
return networkAutoDetectMode;
106-
}
107-
10894
public SELF withNetworkAutoDetectMode(NetworkAutoDetectMode networkAutoDetectMode) {
10995
this.networkAutoDetectMode = networkAutoDetectMode;
11096
return self();
11197
}
11298

113-
public Duration getStartupTimeout() {
114-
return startupTimeout;
115-
}
116-
117-
public SELF withStartupTimeout(Duration startupTimeout) {
118-
this.startupTimeout = startupTimeout;
119-
return self();
120-
}
121-
99+
@AllArgsConstructor
122100
public enum NetworkAutoDetectMode {
123101
IPV6_OR_IPV4("1"),
124102
IPV4_ONLY("4"),
125103
IPV6_ONLY("6");
126104

127-
private String value;
105+
private final String value;
128106

129-
NetworkAutoDetectMode(String value) {
130-
this.value = value;
131-
}
132107
}
133108
}

modules/ceph/src/test/java/org/testcontainers/containers/CephContainerTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public class CephContainerTest {
2828
public CephContainer cephContainer = new CephContainer()
2929
.withAwsAccessKey("test")
3030
.withAwsSecretKey("test")
31-
.withBucketName("test")
32-
.withStartupTimeout(Duration.ofMinutes(5));
31+
.withBucketName("test");
3332

3433
private AmazonS3 amazonS3;
3534

0 commit comments

Comments
 (0)