HADOOP-17167 ITestS3AEncryptionWithDefaultS3Settings failing (#2187)

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

Contributed by Mukund Thakur
This commit is contained in:
Mukund Thakur 2020-09-04 00:05:24 +05:30 committed by GitHub
parent b3660d0147
commit 139a43e98e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

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.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_ALGORITHM;
import static org.apache.hadoop.fs.s3a.Constants.SERVER_SIDE_ENCRYPTION_KEY; 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.S3AEncryptionMethods.SSE_KMS;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides; import static org.apache.hadoop.fs.s3a.S3ATestUtils.removeBaseAndBucketOverrides;
@ -107,6 +108,23 @@ public class ITestS3AEncryptionWithDefaultS3Settings extends
public void testEncryption() throws Throwable { 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 @Test
public void testEncryptionOverRename2() throws Throwable { public void testEncryptionOverRename2() throws Throwable {
S3AFileSystem fs = getFileSystem(); S3AFileSystem fs = getFileSystem();