From 139a43e98e24320aeba23064fe53dc7055db9c4a Mon Sep 17 00:00:00 2001 From: Mukund Thakur Date: Fri, 4 Sep 2020 00:05:24 +0530 Subject: [PATCH] HADOOP-17167 ITestS3AEncryptionWithDefaultS3Settings failing (#2187) Now skips ITestS3AEncryptionWithDefaultS3Settings.testEncryptionOverRename when server side encryption is not set to sse:kms Contributed by Mukund Thakur --- ...TestS3AEncryptionWithDefaultS3Settings.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEncryptionWithDefaultS3Settings.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEncryptionWithDefaultS3Settings.java index 5b807c2b07d..c5ef65ff927 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEncryptionWithDefaultS3Settings.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3AEncryptionWithDefaultS3Settings.java @@ -35,6 +35,7 @@ import static org.apache.hadoop.fs.contract.ContractTestUtils.skip; import static org.apache.hadoop.fs.contract.ContractTestUtils.writeDataset; import static org.apache.hadoop.fs.s3a.Constants.SERVER_SIDE_ENCRYPTION_ALGORITHM; import static org.apache.hadoop.fs.s3a.Constants.SERVER_SIDE_ENCRYPTION_KEY; +import static org.apache.hadoop.fs.s3a.EncryptionTestUtils.AWS_KMS_SSE_ALGORITHM; import static org.apache.hadoop.fs.s3a.S3AEncryptionMethods.SSE_KMS; import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides; @@ -107,6 +108,23 @@ public class ITestS3AEncryptionWithDefaultS3Settings extends public void testEncryption() throws Throwable { } + /** + * Skipping if the test bucket is not configured with + * aws:kms encryption algorithm. + */ + @Override + public void testEncryptionOverRename() throws Throwable { + S3AFileSystem fs = getFileSystem(); + Path path = path(getMethodName() + "find-encryption-algo"); + ContractTestUtils.touch(fs, path); + String sseAlgorithm = fs.getObjectMetadata(path).getSSEAlgorithm(); + if(StringUtils.isBlank(sseAlgorithm) || + !sseAlgorithm.equals(AWS_KMS_SSE_ALGORITHM)) { + skip("Test bucket is not configured with " + AWS_KMS_SSE_ALGORITHM); + } + super.testEncryptionOverRename(); + } + @Test public void testEncryptionOverRename2() throws Throwable { S3AFileSystem fs = getFileSystem();