Skip to content

Commit d99d6c1

Browse files
committed
added README, verify crc32 of uploaded object with an additional get object, precalculated crc32 when possible, rename S3ClientFlavor fields,
1 parent 880c1c8 commit d99d6c1

File tree

7 files changed

+181
-77
lines changed

7 files changed

+181
-77
lines changed

test/s3-tests/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SDK Regression Tests for Amazon S3
2+
3+
## Description
4+
This module contains SDK regression tests for Amazon S3 streaming operations with various SDK configurations.
5+
6+
7+
## How to run
8+
9+
### Credentials
10+
11+
The tests require valid AWS credentials to be available in the default credential file under the `aws-test-account` profile.
12+
13+
### Run the tests
14+
15+
- Run from your IDE
16+
17+
- Run from maven command line
18+
19+
```
20+
mvn clean install -P s3-regression-tests -pl :stability-tests
21+
```
22+
23+
## Adding New Tests
24+
25+
- The tests are built using [JUnit 5](https://junit.org/junit5/). Make sure you are using the correct APIs and mixing of
26+
Junit 4 and Junit 5 APIs on the same test can have unexpected results.
27+
28+
- All tests should have the suffix of `RegressionTesting`, eg: ``
29+
30+
31+

test/s3-tests/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
<dependency>
168168
<groupId>software.amazon.awssdk</groupId>
169169
<artifactId>test-utils</artifactId>
170+
<scope>test</scope>
170171
</dependency>
171172
</dependencies>
172173

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
import software.amazon.awssdk.utils.CompletableFutureUtils;
4343
import software.amazon.awssdk.utils.Logger;
4444

45-
public class DataplaneOperationRegressionTesting extends BaseS3RegressionTest {
46-
private static final Logger LOG = Logger.loggerFor(DataplaneOperationRegressionTesting.class);
45+
public class ControlPlaneOperationRegressionTesting extends BaseS3RegressionTest {
46+
private static final Logger LOG = Logger.loggerFor(ControlPlaneOperationRegressionTesting.class);
4747

4848
// Request checksum required
4949
@ParameterizedTest

test/s3-tests/src/it/java/software/amazon/awssdk/services/s3/regression/DownloadStreamingRegressionTesting.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package software.amazon.awssdk.services.s3.regression;
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
19-
import static software.amazon.awssdk.services.s3.regression.DataplaneOperationRegressionTesting.testConfigs;
19+
import static software.amazon.awssdk.services.s3.regression.ControlPlaneOperationRegressionTesting.testConfigs;
2020
import static software.amazon.awssdk.services.s3.regression.S3ChecksumsTestUtils.assumeNotAccelerateWithArnType;
2121
import static software.amazon.awssdk.services.s3.regression.S3ChecksumsTestUtils.assumeNotAccelerateWithEoz;
2222
import static software.amazon.awssdk.services.s3.regression.S3ChecksumsTestUtils.assumeNotAccelerateWithPathStyle;
@@ -134,13 +134,13 @@ void downloadObject(DownloadConfig config) throws Exception {
134134

135135
CallResponse response;
136136
switch (config.baseConfig().getFlavor()) {
137-
case JAVA_BASED: {
137+
case STANDARD_SYNC: {
138138
response = callSyncGetObject(config, request);
139139
break;
140140
}
141-
case ASYNC_JAVA_BASED:
142-
case TM_JAVA:
143-
case ASYNC_CRT: {
141+
case STANDARD_ASYNC:
142+
case MULTIPART_ENABLED:
143+
case CRT_BASED: {
144144
response = callAsyncGetObject(request, config);
145145
break;
146146
}
@@ -223,18 +223,16 @@ static ObjectWithCRC uploadMultiPartObject() throws Exception {
223223
byte[] fullContent = os.toByteArray();
224224
String crc32 = crc32(fullContent);
225225
for (BucketType bucketType : BucketType.values()) {
226-
doMultipartUpload(bucketType, name, fullContent, crc32);
226+
doMultipartUpload(bucketType, name, fullContent);
227227
}
228228
return new ObjectWithCRC(name, crc32);
229229
}
230230

231-
static void doMultipartUpload(BucketType bucketType, String objectName, byte[] content, String fullContentCRC32) {
231+
static void doMultipartUpload(BucketType bucketType, String objectName, byte[] content) {
232232
String bucket = bucketForType(bucketType);
233233
LOG.debug(() -> String.format("Uploading multipart object for bucket type: %s - %s", bucketType, bucket)
234234
);
235235
CreateMultipartUploadRequest createMulti = CreateMultipartUploadRequest.builder()
236-
// .checksumAlgorithm(ChecksumAlgorithm.CRC32)
237-
// .checksumType(ChecksumType.FULL_OBJECT)
238236
.bucket(bucket)
239237
.key(objectName)
240238
.build();
@@ -492,7 +490,7 @@ private static Path createTempDir(String path) {
492490

493491
private S3Client makeSyncClient(TestConfig config) {
494492
switch (config.getFlavor()) {
495-
case JAVA_BASED:
493+
case STANDARD_SYNC:
496494
return S3Client.builder()
497495
.forcePathStyle(config.isForcePathStyle())
498496
.requestChecksumCalculation(config.getRequestChecksumValidation())
@@ -507,15 +505,15 @@ private S3Client makeSyncClient(TestConfig config) {
507505

508506
private S3AsyncClient makeAsyncClient(TestConfig config) {
509507
switch (config.getFlavor()) {
510-
case ASYNC_JAVA_BASED:
508+
case STANDARD_ASYNC:
511509
return S3AsyncClient.builder()
512510
.forcePathStyle(config.isForcePathStyle())
513511
.requestChecksumCalculation(config.getRequestChecksumValidation())
514512
.region(REGION)
515513
.credentialsProvider(CREDENTIALS_PROVIDER_CHAIN)
516514
.accelerate(config.isAccelerateEnabled())
517515
.build();
518-
case TM_JAVA:
516+
case MULTIPART_ENABLED:
519517
return S3AsyncClient.builder()
520518
.forcePathStyle(config.isForcePathStyle())
521519
.requestChecksumCalculation(config.getRequestChecksumValidation())
@@ -524,7 +522,7 @@ private S3AsyncClient makeAsyncClient(TestConfig config) {
524522
.accelerate(config.isAccelerateEnabled())
525523
.multipartEnabled(true)
526524
.build();
527-
case ASYNC_CRT: {
525+
case CRT_BASED: {
528526
return S3AsyncClient.crtBuilder()
529527
.forcePathStyle(config.isForcePathStyle())
530528
.requestChecksumCalculation(config.getRequestChecksumValidation())

test/s3-tests/src/it/java/software/amazon/awssdk/services/s3/regression/S3ChecksumsTestUtils.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public static String crc32(Path p) throws IOException {
239239

240240
public static S3Client makeSyncClient(TestConfig config, Region region, AwsCredentialsProvider provider) {
241241
switch (config.getFlavor()) {
242-
case JAVA_BASED:
242+
case STANDARD_SYNC:
243243
return S3Client.builder()
244244
.forcePathStyle(config.isForcePathStyle())
245245
.requestChecksumCalculation(config.getRequestChecksumValidation())
@@ -254,15 +254,15 @@ public static S3Client makeSyncClient(TestConfig config, Region region, AwsCrede
254254

255255
public static S3AsyncClient makeAsyncClient(TestConfig config, Region region, AwsCredentialsProvider provider) {
256256
switch (config.getFlavor()) {
257-
case ASYNC_JAVA_BASED:
257+
case STANDARD_ASYNC:
258258
return S3AsyncClient.builder()
259259
.forcePathStyle(config.isForcePathStyle())
260260
.requestChecksumCalculation(config.getRequestChecksumValidation())
261261
.region(region)
262262
.credentialsProvider(provider)
263263
.accelerate(config.isAccelerateEnabled())
264264
.build();
265-
case TM_JAVA:
265+
case MULTIPART_ENABLED:
266266
return S3AsyncClient.builder()
267267
.forcePathStyle(config.isForcePathStyle())
268268
.requestChecksumCalculation(config.getRequestChecksumValidation())
@@ -271,7 +271,7 @@ public static S3AsyncClient makeAsyncClient(TestConfig config, Region region, Aw
271271
.accelerate(config.isAccelerateEnabled())
272272
.multipartEnabled(true)
273273
.build();
274-
case ASYNC_CRT: {
274+
case CRT_BASED: {
275275
return S3AsyncClient.crtBuilder()
276276
.forcePathStyle(config.isForcePathStyle())
277277
.requestChecksumCalculation(config.getRequestChecksumValidation())
@@ -288,7 +288,7 @@ public static S3AsyncClient makeAsyncClient(TestConfig config, Region region, Aw
288288
public static S3Client makeSyncClient(TestConfig config, ClientOverrideConfiguration overrideConfiguration,
289289
Region region, AwsCredentialsProvider provider) {
290290
switch (config.getFlavor()) {
291-
case JAVA_BASED:
291+
case STANDARD_SYNC:
292292
return S3Client.builder()
293293
.overrideConfiguration(overrideConfiguration)
294294
.forcePathStyle(config.isForcePathStyle())
@@ -305,7 +305,7 @@ public static S3Client makeSyncClient(TestConfig config, ClientOverrideConfigura
305305
public static S3AsyncClient makeAsyncClient(TestConfig config, ClientOverrideConfiguration overrideConfiguration,
306306
Region region, AwsCredentialsProvider provider) {
307307
switch (config.getFlavor()) {
308-
case ASYNC_JAVA_BASED:
308+
case STANDARD_ASYNC:
309309
return S3AsyncClient.builder()
310310
.overrideConfiguration(overrideConfiguration)
311311
.forcePathStyle(config.isForcePathStyle())
@@ -314,7 +314,7 @@ public static S3AsyncClient makeAsyncClient(TestConfig config, ClientOverrideCon
314314
.credentialsProvider(provider)
315315
.accelerate(config.isAccelerateEnabled())
316316
.build();
317-
case TM_JAVA:
317+
case MULTIPART_ENABLED:
318318
return S3AsyncClient.builder()
319319
.overrideConfiguration(overrideConfiguration)
320320
.forcePathStyle(config.isForcePathStyle())
@@ -324,7 +324,7 @@ public static S3AsyncClient makeAsyncClient(TestConfig config, ClientOverrideCon
324324
.accelerate(config.isAccelerateEnabled())
325325
.multipartEnabled(true)
326326
.build();
327-
case ASYNC_CRT: {
327+
case CRT_BASED: {
328328
return S3AsyncClient.crtBuilder()
329329
.forcePathStyle(config.isForcePathStyle())
330330
.requestChecksumCalculation(config.getRequestChecksumValidation())

test/s3-tests/src/it/java/software/amazon/awssdk/services/s3/regression/S3ClientFlavor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
package software.amazon.awssdk.services.s3.regression;
1717

1818
public enum S3ClientFlavor {
19-
JAVA_BASED(false),
20-
ASYNC_JAVA_BASED(true),
21-
TM_JAVA(true),
22-
ASYNC_CRT(true)
19+
STANDARD_SYNC(false),
20+
STANDARD_ASYNC(true),
21+
MULTIPART_ENABLED(true),
22+
CRT_BASED(true)
2323
;
2424

2525
private final boolean async;

0 commit comments

Comments
 (0)