Skip to content

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

Merged

Conversation

luigidellaquila
Copy link
Contributor

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

@luigidellaquila luigidellaquila added >test Issues or PRs that are addressing/adding tests :Analytics/ES|QL AKA ESQL labels Apr 9, 2025
@elasticsearchmachine elasticsearchmachine added Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v9.1.0 labels Apr 9, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Copy link
Contributor

@alex-spies alex-spies left a 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));
Copy link
Contributor

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.

Copy link
Contributor

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:

public static String randomIdentifier() {
return randomAlphaOfLengthBetween(8, 12).toLowerCase(Locale.ROOT);
}

Copy link
Contributor Author

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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover?

Copy link
Contributor Author

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

@luigidellaquila
Copy link
Contributor Author

Thanks @alex-spies!

…entifiers' into esql/generative_test_identifiers
@luigidellaquila luigidellaquila enabled auto-merge (squash) April 9, 2025 09:28
@luigidellaquila luigidellaquila merged commit 4129768 into elastic:main Apr 9, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants