-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Speed up integration tests. #2288
Speed up integration tests. #2288
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great PR @big-andy-coates .. Will definitely boost productivity once merged.
I left a couple of comments, but this looks great besides those.
public MetaStore getMetaStore() { | ||
return ksqlEngine.getMetaStore(); | ||
} | ||
|
||
/** | ||
* Execute the ksql statement in this context. | ||
*/ | ||
public void sql(final String sql) { | ||
sql(sql, Collections.emptyMap()); | ||
public List<QueryMetadata> sql(final String sql) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we don't support embedded mode, but KsqlContext
is the way to use embedded mode, right? If so, won't this break existing embedded mode users, especially if the rely on the return value being void
, like:
void someFunction() {
return ksqlContext.sql(myQuery);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow.
First off, I didn't think we'd really supported embedded mode as such. It's not documented anywhere that I'm aware of.
Second, how would they be relying on it returning void? Last time I checked:
void someFunction() {
return ksqlContext.sql(myQuery);
}
Will result in a compilation error, even if sql
returns void
.
I think you've been a manager too long!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding return void types, that is my C++ instinct talking. This is in fact valid C++, but not valid Java:
void myFunction() {
return;
}
void someOtherFunction() {
return myFunction();
}
int main() {
someOtherFunction();
return 0;
}
Also, while we haven't officially advertised embedded mode, we have unofficially recommended it as an option people can use and pointed to internal integration tests as examples to follow.
If we are going to break it, I think it is definitely worth adding a release note to that effect at the very least.
However, given the above, I am not sure that this change breaks anything.
ksql-engine/src/test/java/io/confluent/ksql/integration/IntegrationTestHelper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Test only change, so merging with one review... |
* fork/master: (107 commits) copy-edited (confluentinc#2299) copy-edited (confluentinc#2299) remove unused map from command store `getRestoreCommands` (confluentinc#2296) Speed up integration tests. (confluentinc#2288) Move KSQL Clickstream demo to Examples repo (confluentinc#2270) Bump Confluent to 5.1.1-SNAPSHOT, Kafka to 2.1.1-SNAPSHOT Set Confluent to 5.1.0, Kafka to 2.1.0-cp1. Add ServiceContext (confluentinc#2243) Update to use CCL (confluentinc#2278) Remove redundant intro sentence in README.md (confluentinc#2277) Switch to use CCL (confluentinc#2275) Update readme for CCL (confluentinc#2276) Minor: add Hamcrest matchers for KsqlRestException and KsqlErrorMessage (confluentinc#2273) Update per relicensing (confluentinc#2274) CP-584: 5.1.0 changelog (confluentinc#2267) add null checks to min, max, and count aggregates; call Math.min/max for consistency (confluentinc#2246) Return and accept command topic offsets via REST API (confluentinc#2159) MINOR: Fix bug encountered when restoring RUN SCRIPT command. (again) (confluentinc#2265) More improvements to the way the CLI handles inline comments in multi-line statements. (confluentinc#2241) Fix issue where Avro subject does not exist (confluentinc#2260) ...
Description
Our integration tests were taking up 3/4s of our build time. So I spent a little time speeding them up.
ConsumerGroupTestUtil
to help tests to have unique consumer groups per test, so tests don't interact with each other.TopicTestUtil
to help tests to have unique topic names per test.KsqlIndentifierTestUtil
to help tests tp have unique KSQL identifiers, (think steam/table names), per test.IntergrationTestHarness
a JUnit rule, so it can be used with@ClassRule
.TestKsqlContext
, which is a JUnit rule, to simplify interacting with theKsqlContext
.ConsumerTestUtil
, which has lots of handy methods for consuming messages from Kafka and asserting if too few or too many are consumed.So now, to have an integration test, all you really need is something like:
The result of this work has brought build times
mvn clean install
down from something like:To
Happy days.
note: One of the tests remains unstable. (The Window one I think). This still needs investigating.
Testing done
Test only change.
Reviewer checklist