Skip to content

Commit

Permalink
Skip cross account tests if no cross account credentials are provided (
Browse files Browse the repository at this point in the history
  • Loading branch information
lucienlu-aws authored Apr 30, 2024
1 parent 34fe58c commit ab24b66
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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----------");
Expand Down

0 comments on commit ab24b66

Please sign in to comment.