44import com .amazonaws .auth .AWSStaticCredentialsProvider ;
55import com .amazonaws .auth .BasicAWSCredentials ;
66import 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
911import java .time .Duration ;
1012
13+ @ Getter
1114public 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}
0 commit comments