-
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
feat: introduce the sql-based testing tool (YATT) #6051
Conversation
} | ||
|
||
public enum Type { | ||
TEST("test"), | ||
EXPECTED_ERROR("expected.error"), | ||
EXPECTED_MESSAGE("expected.message"), | ||
ENABLED("enabled"), |
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.
removed this because it's not super easy to implement cleanly given the iterative nature of the tests. since the sql file supports multiline comments, it's easy enough to disable a test like this:
/* (disabled)
--@test: foo bar
CREATE STREAM foo...;
INSERT INTO ...;
ASSERT VALUES ...;
*/
} | ||
} | ||
|
||
public static void assertStream(final AssertStream assertStatement) { |
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'll implement these in a future PR since to do it "right" involves some engine refactoring to leverage what we already have in production code
ksqldb-functional-tests/src/main/java/io/confluent/ksql/test/parser/SqlTestLoader.java
Outdated
Show resolved
Hide resolved
-- this test file is a "meta-test" that tests the basic functionality of the KsqlTester | ||
-- eventually, we plan to remove this test in favor of migrating the QTTs over to use this format | ||
-- directly | ||
|
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 see anything related to windowing is missing. Is this because it is not supported in this PR yet?
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.
Windowed keys aren't yet supported in our grammar so it'll take a bit of extra work to add support for windowing - I'll work on this after I have some basic query upgrade tests written
CREATE STREAM bar AS SELECT * FROM foo; | ||
|
||
INSERT INTO foo (rowtime, id, col1) VALUES (1, 1, 1); | ||
ASSERT VALUES bar (rowtime, id, col1) VALUES (1, 1, 1); |
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.
Also, Assert stream
and Assert table
are missing
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.
yes, they are not implemented yet (see AssertExecutor
)
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 just saw your comment in AssertExecutor
so nvm
* @param path the top-level dir to load | ||
*/ | ||
public SqlTestLoader(final Predicate<SqlTest> testFilter, final Path path) { | ||
this.shouldRun = Objects.requireNonNull(testFilter, "testFilter"); |
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.
How would the shouldRun
be used? Will there be tests in a test file that one can indicate that they should be skipped? If so, should we add an example to test.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.
the idea was to use shouldRun
to filter tests to run or not run based on some regex exp. I wasn't going to implement it in this PR quite yet but I figured I might as well set it up here
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! Super excited to see this
Description
First draft at the fully implemented
KsqlTester
(see #5965). Review guide:test.sql
to see how the testing tool works end-to-endKsqlTesterTest
to see the full test in action. I'm planning on refactoring this further when I make it a standalone tool, but given that I want this to test query upgrades I'm leaving this in a little bit of a rougher state for nowSqlTestLoader
to see how we load testsAssertExecutor
to look at asserting mechanism. I'm planning on improving the assertion mechanism to leverage theSELECT
formatting of rows when I make this tool public, but for now it just compares the Generic representation of rows directyTesting done
test.sql
tests this end to endReviewer checklist