HADOOP-17167 ITestS3AEncryptionWithDefaultS3Settings failing (#2187)

Now skips ITestS3AEncryptionWithDefaultS3Settings.testEncryptionOverRename
when server side encryption is not set to sse:kms

Contributed by Mukund Thakur

Change-Id: Ifd83d353e9c7c6f7e1195a2c2f138d85cf876bb1
This commit is contained in:
Mukund Thakur 2020-09-04 00:05:24 +05:30 committed by Steve Loughran
parent 38354006f8
commit 5236c96ead
No known key found for this signature in database
GPG Key ID: D22CF846DBB162A0

View File

@ -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();