diff --git a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/application/TestConsumer.java b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/application/TestConsumer.java index 5bfb928af..47e879041 100644 --- a/amazon-kinesis-client/src/test/java/software/amazon/kinesis/application/TestConsumer.java +++ b/amazon-kinesis-client/src/test/java/software/amazon/kinesis/application/TestConsumer.java @@ -44,6 +44,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import static org.junit.Assume.assumeTrue; + @Slf4j public class TestConsumer { public final KCLAppConfig consumerConfig; @@ -79,8 +81,9 @@ public TestConsumer(KCLAppConfig consumerConfig) throws Exception { public void run() throws Exception { + // Skip cross account tests if no cross account credentials are provided if (consumerConfig.isCrossAccount()) { - verifyCrossAccountCreds(); + assumeTrue(consumerConfig.getCrossAccountCredentialsProvider() != null); } final StreamExistenceManager streamExistenceManager = new StreamExistenceManager(this.consumerConfig); @@ -126,13 +129,6 @@ public void run() throws Exception { } } - private void verifyCrossAccountCreds() { - if (consumerConfig.getCrossAccountCredentialsProvider() == null) { - throw new RuntimeException("To run cross account integration tests, pass in an AWS profile with -D" + - KCLAppConfig.CROSS_ACCOUNT_PROFILE_PROPERTY); - } - } - private void cleanTestResources(StreamExistenceManager streamExistenceManager, LeaseTableManager leaseTableManager) throws Exception { log.info("----------Before starting, Cleaning test environment----------"); log.info("----------Deleting all lease tables in account----------");