Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding resharding integration tests and changing ITs to not run by default #1152

Merged
merged 8 commits into from
Aug 3, 2023

Conversation

mmankika-aws
Copy link
Contributor

Issue #, if available:

Description of changes:

Adding KCL 2.x reshard integration test. Updating settings in pom.xml so that integration tests don't run by default. The instructions to build source and run tests in README has been updated to reflect this.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mmankika-aws mmankika-aws added the v2.x Issues related to the 2.x version label Jun 26, 2023
@mmankika-aws mmankika-aws self-assigned this Jun 26, 2023
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Comment on lines 98 to 100
Thread.sleep(TimeUnit.SECONDS.toMillis(60 * 3));
} else {
Thread.sleep(TimeUnit.SECONDS.toMillis(60 * 8));
Copy link
Contributor

Choose a reason for hiding this comment

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

KISS: use TimeUnit.MINUTES instead of converting seconds.

DRY: The only variable changing here is the duration.

final int sleepMinutes = (consumerConfig.getReshardConfig() == null) ? 3 : 8;
Thread.sleep(TimeUnit.MINUTES.toMillis(sleepMinutes));

What guarantees these magic numbers will be sufficient? How might the code be enhanced to avoid static waits?

Consider reading for ideas:


// Reshard logic if required for the test
if (consumerConfig.getReshardConfig() != null) {
log.info("------------------------- Reshard Config found -----------------------------");
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: --- is unnecessary.

This log statement lacks context. Log the reshard config.

// Send dummy data to stream
this.producerExecutor = Executors.newSingleThreadScheduledExecutor();
this.producerFuture = producerExecutor.scheduleAtFixedRate(this::publishRecord, 60, 1, TimeUnit.SECONDS);
producerExecutor = Executors.newSingleThreadScheduledExecutor();
Copy link
Contributor

Choose a reason for hiding this comment

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

This instantiation should occur outside this block, otherwise there's a non-zero risk that an Exception, or future refactor, might raise NPEs.

} else {
log.info("No scaling factor found in queue");
}
} catch (Exception e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Whenever possible, please be more explicit than Exception. Catching Exception|RuntimeException|Throwable is generally regarded as bad smell.

@@ -152,6 +183,16 @@ private void startConsumer() {
this.consumerFuture = consumerExecutor.schedule(scheduler, 0, TimeUnit.SECONDS);
}

public void stopProducer() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Change back to private

@ZeyuLi-AWS ZeyuLi-AWS merged commit 46cd117 into awslabs:master Aug 3, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2.x Issues related to the 2.x version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants