16
16
package software .amazon .awssdk .stability .tests .s3 ;
17
17
18
18
import static org .assertj .core .api .Assertions .assertThat ;
19
+ import static software .amazon .awssdk .stability .tests .utils .StabilityTestRunner .ALLOWED_MAX_PEAK_THREAD_COUNT ;
19
20
20
21
import java .io .File ;
21
22
import java .io .IOException ;
@@ -61,10 +62,18 @@ public abstract class S3AsyncBaseStabilityTest extends AwsTestBase {
61
62
.build ();
62
63
}
63
64
65
+ private final int allowedPeakThreads ;
66
+
64
67
public S3AsyncBaseStabilityTest (S3AsyncClient testClient ) {
68
+ this (testClient , ALLOWED_MAX_PEAK_THREAD_COUNT );
69
+ }
70
+
71
+ public S3AsyncBaseStabilityTest (S3AsyncClient testClient , int maxThreadCount ) {
72
+ this .allowedPeakThreads = maxThreadCount ;
65
73
this .testClient = testClient ;
66
74
}
67
75
76
+
68
77
@ RetryableTest (maxRetries = 3 , retryableException = StabilityTestsRetryableException .class )
69
78
public void largeObject_put_get_usingFile () {
70
79
String md5Upload = uploadLargeObjectFromFile ();
@@ -87,7 +96,7 @@ protected String computeKeyName(int i) {
87
96
protected void doGetBucketAcl_lowTpsLongInterval () {
88
97
IntFunction <CompletableFuture <?>> future = i -> testClient .getBucketAcl (b -> b .bucket (getTestBucketName ()));
89
98
String className = this .getClass ().getSimpleName ();
90
- StabilityTestRunner .newRunner ()
99
+ StabilityTestRunner .newRunner (allowedPeakThreads )
91
100
.testName (className + ".getBucketAcl_lowTpsLongInterval" )
92
101
.futureFactory (future )
93
102
.requestCountPerRun (10 )
@@ -99,7 +108,7 @@ protected void doGetBucketAcl_lowTpsLongInterval() {
99
108
100
109
protected String downloadLargeObjectToFile () {
101
110
File randomTempFile = RandomTempFile .randomUncreatedFile ();
102
- StabilityTestRunner .newRunner ()
111
+ StabilityTestRunner .newRunner (allowedPeakThreads )
103
112
.testName ("S3AsyncStabilityTest.downloadLargeObjectToFile" )
104
113
.futures (testClient .getObject (b -> b .bucket (getTestBucketName ()).key (LARGE_KEY_NAME ),
105
114
AsyncResponseTransformer .toFile (randomTempFile )))
@@ -120,7 +129,7 @@ protected String uploadLargeObjectFromFile() {
120
129
try {
121
130
file = new RandomTempFile ((long ) 2e+9 );
122
131
String md5 = Md5Utils .md5AsBase64 (file );
123
- StabilityTestRunner .newRunner ()
132
+ StabilityTestRunner .newRunner (allowedPeakThreads )
124
133
.testName ("S3AsyncStabilityTest.uploadLargeObjectFromFile" )
125
134
.futures (testClient .putObject (b -> b .bucket (getTestBucketName ()).key (LARGE_KEY_NAME ),
126
135
AsyncRequestBody .fromFile (file )))
@@ -144,7 +153,7 @@ protected void putObject() {
144
153
AsyncRequestBody .fromBytes (bytes ));
145
154
};
146
155
147
- StabilityTestRunner .newRunner ()
156
+ StabilityTestRunner .newRunner (allowedPeakThreads )
148
157
.testName ("S3AsyncStabilityTest.putObject" )
149
158
.futureFactory (future )
150
159
.requestCountPerRun (CONCURRENCY )
@@ -160,7 +169,7 @@ protected void getObject() {
160
169
return testClient .getObject (b -> b .bucket (getTestBucketName ()).key (keyName ), AsyncResponseTransformer .toFile (path ));
161
170
};
162
171
163
- StabilityTestRunner .newRunner ()
172
+ StabilityTestRunner .newRunner (allowedPeakThreads )
164
173
.testName ("S3AsyncStabilityTest.getObject" )
165
174
.futureFactory (future )
166
175
.requestCountPerRun (CONCURRENCY )
@@ -183,7 +192,7 @@ protected static void deleteBucketAndAllContents(S3AsyncClient client, String bu
183
192
184
193
client .deleteBucket (DeleteBucketRequest .builder ().bucket (bucketName ).build ()).join ();
185
194
} catch (Exception e ) {
186
- log .error (() -> "Failed to delete bucket: " +bucketName );
195
+ log .error (() -> "Failed to delete bucket: " + bucketName , e );
187
196
}
188
197
}
189
198
0 commit comments