Skip cross account tests if no cross account credentials are provided (#1321)

This commit is contained in:
lucienlu-aws 2024-04-30 16:56:05 -07:00 committed by GitHub
parent 34fe58c492
commit ab24b66039
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,6 +44,8 @@ import java.util.concurrent.ScheduledFuture;
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 class TestConsumer {
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 class TestConsumer {
}
}
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----------");