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

fix: fix test for KIP-307 final PR #3402

Merged
merged 2 commits into from
Sep 30, 2019
Merged

Conversation

bbejeck
Copy link
Contributor

@bbejeck bbejeck commented Sep 23, 2019

Description

The fifth and final PR for KIP-307 is getting merged today. This PR adds the following overload KGoupedTable.aggregate(Initializer, Aggregator, Aggregator, Named).

This causes an error with the SchemaKGroupedTableTest when executing mockKGroupedTable.aggregate(any(), any(), any(), any())) method. The compiler can't disambiguate the 4th argument, as it's either a Materialized or a Named object. This PR fixes the test.

Update this PR build is passing now and can be merged once approved.

Testing done

I updated the test and ran the entire KSQL test suite, all tests passed.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@bbejeck bbejeck requested a review from a team as a code owner September 23, 2019 17:00
@@ -174,7 +174,7 @@ public void init() {

when(aggregateSchema.value()).thenReturn(mock(List.class));

when(mockKGroupedTable.aggregate(any(), any(), any(), any())).thenReturn(table);
when(mockKGroupedTable.aggregate(any(), any(), any(), (Materialized)any())).thenReturn(table);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be cleaner to do any(Materialized.class).

Copy link
Contributor Author

@bbejeck bbejeck Sep 24, 2019

Choose a reason for hiding this comment

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

Ack. I updated one instance of (Materialized)any() to any(Materialized.class) on line 314.

But changing this line to use any(Materialized.class) caused NullPointerExceptions in the test.

The reason for this from what I can see is that this function returns null instead of a Materialized instance in the test:
https://github.com/confluentinc/ksql/blob/master/ksql-engine/src/main/java/io/confluent/ksql/structured/SchemaKGroupedTable.java#L154-L158

By changing the mock to expect a Materialized.class explicitly I think the mock returns null instead of the KTable instance when this is called ( https://github.com/confluentinc/ksql/blob/master/ksql-engine/src/main/java/io/confluent/ksql/structured/SchemaKGroupedTable.java#L160-L164)

I'm thinking this is ok as is or we could add something like when(materializedFactory.create(any(), any(), any())).thenReturn(materialized); in the init() method. WDYT?

@bbejeck
Copy link
Contributor Author

bbejeck commented Sep 24, 2019

@rodesai updated per comments

@apurvam apurvam requested a review from a team September 30, 2019 14:33
@bbejeck bbejeck force-pushed the MINOR_changes_for_KIP_307_final_PR branch from 3d9db48 to 4956c5e Compare September 30, 2019 15:45
@bbejeck
Copy link
Contributor Author

bbejeck commented Sep 30, 2019

Rebased and updated for additional test

Copy link
Contributor

@rodesai rodesai left a comment

Choose a reason for hiding this comment

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

LGTM

@bbejeck bbejeck changed the title MINOR: Fix test for KIP-307 final PR fix: fix test for KIP-307 final PR Sep 30, 2019
@bbejeck bbejeck merged commit d77db50 into master Sep 30, 2019
@bbejeck bbejeck deleted the MINOR_changes_for_KIP_307_final_PR branch September 30, 2019 18:22
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