NIFI-13206 Updated S3 Integration Tests to delete bucket encryption

- Enabled S3 and SQS Integration Tests

This closes #8801

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Mark Payne 2024-05-09 19:44:45 -04:00 committed by exceptionfactory
parent dcf66fd105
commit c09144051f
No known key found for this signature in database
3 changed files with 8 additions and 15 deletions

View File

@ -104,6 +104,7 @@ public abstract class AbstractS3IT {
final CreateBucketRequest request = new CreateBucketRequest(BUCKET_NAME); final CreateBucketRequest request = new CreateBucketRequest(BUCKET_NAME);
client.createBucket(request); client.createBucket(request);
client.deleteBucketEncryption(BUCKET_NAME);
} }
@BeforeEach @BeforeEach

View File

@ -36,7 +36,7 @@ import java.util.Map;
*/ */
public class ITFetchS3Object extends AbstractS3IT { public class ITFetchS3Object extends AbstractS3IT {
@Test @Test
public void testSimpleGet() throws IOException, InitializationException { public void testSimpleGet() throws IOException {
putTestFile("test-file", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME)); putTestFile("test-file", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
final TestRunner runner = initRunner(FetchS3Object.class); final TestRunner runner = initRunner(FetchS3Object.class);
@ -49,13 +49,13 @@ public class ITFetchS3Object extends AbstractS3IT {
runner.assertAllFlowFilesTransferred(FetchS3Object.REL_SUCCESS, 1); runner.assertAllFlowFilesTransferred(FetchS3Object.REL_SUCCESS, 1);
final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(FetchS3Object.REL_SUCCESS); final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(FetchS3Object.REL_SUCCESS);
MockFlowFile ff = ffs.get(0); MockFlowFile ff = ffs.getFirst();
ff.assertAttributeNotExists(PutS3Object.S3_SSE_ALGORITHM); ff.assertAttributeNotExists(PutS3Object.S3_SSE_ALGORITHM);
ff.assertContentEquals(getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME)); ff.assertContentEquals(getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
} }
@Test @Test
public void testSimpleGetEncrypted() throws IOException, InitializationException { public void testSimpleGetEncrypted() throws IOException {
putTestFileEncrypted("test-file", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME)); putTestFileEncrypted("test-file", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
final TestRunner runner = initRunner(FetchS3Object.class); final TestRunner runner = initRunner(FetchS3Object.class);
@ -67,13 +67,13 @@ public class ITFetchS3Object extends AbstractS3IT {
runner.assertAllFlowFilesTransferred(FetchS3Object.REL_SUCCESS, 1); runner.assertAllFlowFilesTransferred(FetchS3Object.REL_SUCCESS, 1);
final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(FetchS3Object.REL_SUCCESS); final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(FetchS3Object.REL_SUCCESS);
MockFlowFile ff = ffs.get(0); MockFlowFile ff = ffs.getFirst();
ff.assertAttributeEquals(PutS3Object.S3_SSE_ALGORITHM, ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION); ff.assertAttributeEquals(PutS3Object.S3_SSE_ALGORITHM, ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
ff.assertContentEquals(getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME)); ff.assertContentEquals(getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
} }
@Test @Test
public void testFetchS3ObjectUsingCredentialsProviderService() throws Throwable { public void testFetchS3ObjectUsingCredentialsProviderService() {
putTestFile("test-file", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME)); putTestFile("test-file", getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
final TestRunner runner = initRunner(FetchS3Object.class); final TestRunner runner = initRunner(FetchS3Object.class);
@ -105,7 +105,7 @@ public class ITFetchS3Object extends AbstractS3IT {
} }
@Test @Test
public void testContentsOfFileRetrieved() throws IOException, InitializationException { public void testContentsOfFileRetrieved() throws IOException {
String key = "folder/1.txt"; String key = "folder/1.txt";
putTestFile(key, getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME)); putTestFile(key, getFileFromResourceName(SAMPLE_FILE_RESOURCE_NAME));
@ -119,7 +119,7 @@ public class ITFetchS3Object extends AbstractS3IT {
runner.assertAllFlowFilesTransferred(FetchS3Object.REL_SUCCESS, 1); runner.assertAllFlowFilesTransferred(FetchS3Object.REL_SUCCESS, 1);
final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(FetchS3Object.REL_SUCCESS); final List<MockFlowFile> ffs = runner.getFlowFilesForRelationship(FetchS3Object.REL_SUCCESS);
final MockFlowFile out = ffs.iterator().next(); final MockFlowFile out = ffs.getFirst();
final byte[] expectedBytes = Files.readAllBytes(getResourcePath(SAMPLE_FILE_RESOURCE_NAME)); final byte[] expectedBytes = Files.readAllBytes(getResourcePath(SAMPLE_FILE_RESOURCE_NAME));
out.assertContentEquals(new String(expectedBytes)); out.assertContentEquals(new String(expectedBytes));

View File

@ -1052,16 +1052,8 @@
!ITPutKinesisStreamWithEndpointOverride#testIntegrationSuccess, !ITPutKinesisStreamWithEndpointOverride#testIntegrationSuccess,
!ITPutKinesisFirehoseWithEndpointOverride#testIntegrationSuccess, !ITPutKinesisFirehoseWithEndpointOverride#testIntegrationSuccess,
!ITPutKinesisFirehose, !ITPutKinesisFirehose,
!ITTagS3Object,
!ITFetchS3Object,
!ITDeleteS3Object,
!ITPutS3Object,
!ITListS3,
!ITPutSNS#testPublish, !ITPutSNS#testPublish,
!ITPutSNS#testPublishWithCredentialsProviderService, !ITPutSNS#testPublishWithCredentialsProviderService,
!ITDeleteSQS,
!ITGetSQS,
!ITPutSQS,
!ITPutLambda, !ITPutLambda,
!GetMongoIT#testDatabaseEL, !GetMongoIT#testDatabaseEL,
!PutGridFSIT#testFileNameAndHashUniqueness, !PutGridFSIT#testFileNameAndHashUniqueness,