Skip to content

Commit 09eeb45

Browse files
committed
HADOOP-18965. ITestS3AHugeFilesEncryption failure
Change-Id: I0e826af64f09992f385ed8f5f8064f016a9084c6
1 parent f58945d commit 09eeb45

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/scale/ITestS3AHugeFilesEncryption.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@
2525
import org.apache.hadoop.fs.Path;
2626
import org.apache.hadoop.fs.s3a.Constants;
2727
import org.apache.hadoop.fs.s3a.EncryptionTestUtils;
28+
import org.apache.hadoop.fs.s3a.S3AEncryptionMethods;
2829
import org.apache.hadoop.fs.s3a.S3AFileSystem;
2930

3031
import static org.apache.hadoop.fs.s3a.Constants.S3_ENCRYPTION_ALGORITHM;
3132
import static org.apache.hadoop.fs.s3a.S3AEncryptionMethods.DSSE_KMS;
3233
import static org.apache.hadoop.fs.s3a.S3AEncryptionMethods.SSE_KMS;
3334
import static org.apache.hadoop.fs.s3a.S3ATestUtils.getTestBucketName;
3435
import static org.apache.hadoop.fs.s3a.S3ATestUtils.skipIfEncryptionNotSet;
36+
import static org.apache.hadoop.fs.s3a.S3AUtils.getEncryptionAlgorithm;
3537
import static org.apache.hadoop.fs.s3a.S3AUtils.getS3EncryptionKey;
3638

3739
/**
@@ -68,13 +70,16 @@ protected boolean isEncrypted(S3AFileSystem fileSystem) {
6870
@Override
6971
protected void assertEncrypted(Path hugeFile) throws IOException {
7072
Configuration c = new Configuration();
71-
String kmsKey = getS3EncryptionKey(getTestBucketName(c), c);
72-
if (SSE_KMS.getMethod().equals(c.get(S3_ENCRYPTION_ALGORITHM))) {
73+
74+
final String bucket = getTestBucketName(c);
75+
String kmsKey = getS3EncryptionKey(bucket, c);
76+
final S3AEncryptionMethods algorithm = getEncryptionAlgorithm(bucket, c);
77+
if (SSE_KMS.equals(algorithm)) {
7378
EncryptionTestUtils.assertEncrypted(getFileSystem(), hugeFile, SSE_KMS, kmsKey);
74-
} else if (DSSE_KMS.getMethod().equals(c.get(S3_ENCRYPTION_ALGORITHM))) {
79+
} else if (DSSE_KMS.equals(algorithm)) {
7580
EncryptionTestUtils.assertEncrypted(getFileSystem(), hugeFile, DSSE_KMS, kmsKey);
7681
} else {
77-
throw new AssertionError("Invalid encryption configured");
82+
throw new AssertionError("Invalid encryption configured: " + algorithm);
7883
}
7984
}
8085
}

0 commit comments

Comments
 (0)