-
Notifications
You must be signed in to change notification settings - Fork 25.2k
ES|QL: generative tests - fix identifiers generation and source field mapping #126514
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
ES|QL: generative tests - fix identifiers generation and source field mapping #126514
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
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.
Thanks Luigi!
@@ -526,4 +526,8 @@ private static String constantExpression() { | |||
|
|||
} | |||
|
|||
private static String randomIdentifier() { | |||
return randomAlphaOfLength(randomIntBetween(8, 12)); |
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.
Let's add a comment that explains that having at least 8 chars prevents us from accidentally using the not
keyword; maybe future us will want the 3 char identifiers back, and will have to exclude not
specifically.
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.
You might borrow/import one from EsTestCase:
elasticsearch/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java
Lines 1278 to 1280 in 1943844
public static String randomIdentifier() { | |
return randomAlphaOfLengthBetween(8, 12).toLowerCase(Locale.ROOT); | |
} |
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'd say let's keep it as it is, the comment is the only real added value, but maybe it will save us from future headaches
@@ -315,7 +315,7 @@ private static boolean isLookupDataset(TestDataset dataset) throws IOException { | |||
return (mode != null && mode.equalsIgnoreCase("lookup")); | |||
} | |||
|
|||
private static boolean isSourceMappingDataset(TestDataset dataset) throws IOException { |
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.
Leftover?
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, started using it in the query generator, but then I simplified the code.
Reverting now
Thanks @alex-spies! |
…entifiers' into esql/generative_test_identifiers
Making generative tests more stable by generating longer identifiers (avoiding collisions with reserved keywords).
Also fixing the way we manage environments where source field mapping is not supported