Skip to content

Add integration tests for S3 Assume Role ingestion feature#11472

Merged
maytasm merged 5 commits intoapache:masterfrom
maytasm:IMPLY-8319
Jul 23, 2021
Merged

Add integration tests for S3 Assume Role ingestion feature#11472
maytasm merged 5 commits intoapache:masterfrom
maytasm:IMPLY-8319

Conversation

@maytasm
Copy link
Contributor

@maytasm maytasm commented Jul 21, 2021

Add integration tests for S3 Assume Role ingestion feature

Description

This PR adds integration tests for S3 Assume Role ingestion feature introduced in https://github.com/apache/druid/pull/10995/files

The new integration tests are not run as part of Travis since it requires S3 credentials of an active AWS account. While the new integration tests are added to existing test group, they will be skip if the required properties for S3 Role are not provided (-Ddruid.test.config.s3AssumeRoleWithExternalId, -Ddruid.test.config.s3AssumeRoleExternalId, -Ddruid.test.config.s3AssumeRoleWithoutExternalId). This is done in order to keep existing test groups passing without the immediate needs to provide the new properties.

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Comment on lines 53 to 55
if (config.getS3AssumeRoleExternalId() == null || config.getS3AssumeRoleWithExternalId() == null) {
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of exiting silently I think this should throw an exception. The caller should handle this exception gracefully and mark the test as skipped - instead of marking it as passed - since the test hasn't run yet.

Similar comments for the other functions in this class

Copy link
Contributor Author

@maytasm maytasm Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have spent a few hours but was not able to achieve this. I have tried using Assume.assumeTrue which should throw an AssumptionViolatedException which the test runner should then handle gracefully and mark the test as skipped. However, the test runner doesn't and the AssumptionViolatedException caused the test to failed. I have tried looking at the version of junit, surefire, etc and was not able to figure out what's wrong. I also could not find any other way of programmatically skipping the test within the test code. Let me know if you have any idea of achieving this. (things like @Ignore does not work in this case as the skip have to be done programmatically within the test method).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The integration tests are in testNG. That might be why the assume true statement didn't work.

I think you need to throw a skip exception to skip the tests. I found a few examples while googling but I haven't been able to verify any of these myself

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops you are right. Got the skip working. facepalm

* should not have external id set)
*
* NOTE: Tests in this class will be skipped if properties in #4 are not set.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 these instructions are great! thank you!

Copy link
Contributor

@suneet-s suneet-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good but CI failure looks legit

Copy link
Contributor

@suneet-s suneet-s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after CI

@maytasm maytasm merged commit 161f4db into apache:master Jul 23, 2021
@maytasm maytasm deleted the IMPLY-8319 branch July 23, 2021 03:09
@clintropolis clintropolis added this to the 0.22.0 milestone Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants