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

positions storage tck #14

Merged
merged 5 commits into from
Aug 2, 2018
Merged

positions storage tck #14

merged 5 commits into from
Aug 2, 2018

Conversation

lanwen
Copy link
Collaborator

@lanwen lanwen commented Aug 1, 2018

No description provided.

@lanwen lanwen requested a review from bsideup August 1, 2018 15:25
void setUp() {
dynamoDB.createTable(new CreateTableRequest(
asList(
new AttributeDefinition("topic", ScalarAttributeType.S),
Copy link
Owner

Choose a reason for hiding this comment

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

plz use constants from DynamoDBPositionsStorage

.concat(
asDeferMono(() -> getStorage().update(getTopic(), groupId, 2, 2)),
asDeferMono(() -> getStorage().update(getTopic(), groupId2, 2, 3)),
asDeferMono(() -> getStorage().update(getTopic() + 1, groupId2, 2, 4)),
Copy link
Owner

Choose a reason for hiding this comment

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

+1 looks weird here, would be better to extract a variable and use a random topic name instead.
Also, probably makes sense to not have getTopic() method at all, but use val topic = UUID.randomUUID().toString() in every test

default void shouldSavePosition() {
GroupId groupId = GroupId.ofString(UUID.randomUUID().toString());

Map<Integer, Long> positions = asDeferMono(() -> getStorage().update(getTopic(), groupId, 2, 2))
Copy link
Owner

Choose a reason for hiding this comment

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

what if instead of asDeferMono we use await(getStorage().update(getTopic(), groupId, 2, 2)), where await is something like:

<T> T await(CompletionStage<T> future) {
    return future.toCompetableFuture().get(10, SECONDS);
}

?

import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;

public interface PositionsStorageTests extends PositionsStorageTestSupport {
Copy link
Owner

Choose a reason for hiding this comment

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

could you please split this into a few (akin Records Storage TCK)?
e.g. GroupsTest, PersistenceTest, etc.

It will also make it easy to add more tests & categories in future

Copy link
Owner

@bsideup bsideup left a comment

Choose a reason for hiding this comment

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

Awesome, thanks! 👍

@bsideup bsideup merged commit 772381c into master Aug 2, 2018
@bsideup bsideup deleted the pos branch August 2, 2018 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants